Pass custom variable to view
Try reading this.

return $this-&gt;render('index', ['twitterFeed' =&gt; $twitterFeed]); is correct in craft 3 you just need to do some custom routing in order to reroute the homepage to your controller/action.