Advanced routing with React Router
The primary goal of this chapter is to build a profile page for your users. We need a separate page to show all of the content that a single user has entered or created. The content would not fit next to the posts feed. When looking at Facebook, we can see that every user has their own address, under which we can find the profile page of a specific user. We are going to create our profile page in the same way and use the username as the custom path.
We have to implement the following features:
- We add a new parameterized route for the user profile. The path starts with
/user/
and follows a username. - We change the user profile page to send all GraphQL queries, including the
username
route parameter, inside of thevariables
field of the GraphQL request. - We edit the
postsFeed
query to filter all posts by theusername
parameter provided. - We implement a new GraphQL query on the backend to request a user by their username, in order...