Fetching Article Feed Based on Tabs

Learn how to fetch articles on the basis of tabs selected.

We'll cover the following

In this lesson, we are going to fetch the articles feed on the Home screen based on the tabs. If the tab is on the Your Feed option, then we are going to fetch the user’s article feed dispatching the action getUserFeed. If the tab is on the Global option then, we are going to fetch all the articles dispatching the action getGlobalFeed.

First, we need to implement the UI section. We are going to show the Your Feed option only when the user is logged in. Hence, we need to use conditional rendering here. The overall coding implementation is provided in the code snippet below:

Get hands-on with 1200+ tech skills courses.