Curated articles, resources, tips and trends from the DevOps World.
Summary: This is a summary of an article originally published by the source. Read the full original article here →
Users can create posts in these subreddits, which means that there is a many-to-one relationship between posts and subreddits. Each post belongs to exactly one subreddit, and each subreddit can contain many posts.
Next, we’ll install react-router-dom so that we can do client-side routing in the single-page app with React Router: Using React Router, we can create routes for each of our pages: home, subreadit, post, and user.
We can first create the Apollo client like so: And then we can wrap our main App component in the ApolloProvider in the index.js file: Now that we have our routing set up and Apollo ready to go, we can begin building the pages for each of our routes.
If we click on one of the subreadits from the home page, we’ll be taken to that particular subreadit’s page, where we can see all the posts under that topic: On this page, we need the data for the subreadit name and description — just like we have on the home page.
Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com