React Router inside Next.js
I saw a person using the React Router inside Next.js and I have so many questions. Like the navigation is visibly very fast, but my questions are:
- Is it good for public pages? Because I think, it will have same SEO issues as SPAs.
- Does it make the codebase more complicated?
Upon looking I found a detailed blog post on building a SPA using Next.js and React Router. It mentions the reason for not using the Next.js router:
Next.js is not as flexible as React Router! React Router lets you nest routers hierarchically in a flexible way. It's easy for any "parent" router to share data with all of its "child" routes. This is true for both top-level routes (e.g.
/about
and/team
) and nested routes (e.g./settings/team
and/settings/user
).
I do understand why someone would want to use Next.js but I have yet to learn more about this React Router thing.
BRB.
Update:
Josh has written a new short blog post about how he did it, definitely worth reading and understanding the process.
- ← Previous
Best way to create CSS cards - Next →
About action and information
Comment via email