News List
After setting up the project. We can start building our website. Let's start with building the home page of Hacker News.
#
1. Create some newsIf you are using ReactSDK Tutorial community, there already exist some news. But if you started with your community, create some posts in the default space of your community (typically named "General").
#
2. Show the news in your websiteNow we easily use the useFeed
hook to retrieve the data from the community
and show it in out website.
App.tsx
note
The data retrieved from useFeed
is paginated we use simplifyPaginatedResult
to flatten them in to an array.
Now your website will show the titles of the news.
#
3. Let's add some stylingFor this tutorial we will use tailwindcss. You can install tailwindcss to your React app.
App.tsx
note
You can see the final result here.