DEV Community

loading...

Discussion on: Use next.js with react-router

Collapse
8kigai profile image
8kigai

Hi, is that a typo in the static router closing tag in // next/with-react-router.js ??

</StaticRouterlocation={this.props.router.asPath}>

And also I am wondering what is the benefit of using react router instead of next/router?

Collapse
toomuchdesign profile image
Andrea Carraro Author

Hi @8kigai , yep, definitely a typo, thanks for pointing out.
The 2 routing systems take 2 very different approaches. There's not best one but just tradeoffs.

In my last project we had an architectural setup which made very hard to write custom server configuration to properly handle custom url parameters. They come for almost free with react-router, for example.

The codebase was also very bound to react-router's ability of rendering nested Route components instead of relying on file system routing.