fridays / next-routes

Universal dynamic routes for Next.js
MIT License
2.47k stars 230 forks source link

is there any way to use this together with withRouter() #175

Closed reflog closed 6 years ago

reflog commented 6 years ago

...and if not, how should I inject the router into current component? (for example to access current path)

typeofweb commented 6 years ago

You can use withRouter. Did you get any errors?

reflog commented 6 years ago

no errors, just curious if the injected router will be the correct one (from routes.js) and the the default one

typeofweb commented 6 years ago

It works. The only caveat is it won't rerender on when you have a dynamic route and the dynamic part changes. You have to use Router events for that. (Or at least I have that problem, but maybe I'm doing something wrong)

reflog commented 6 years ago

gotcha. thanks!

haotangio commented 5 years ago

There is problem

I cannot use this.props.router.push, it reload the browser instead of keeping single page navigation.

guiihlopes commented 5 years ago

Same with me @haotangio

bmathews commented 5 years ago

@haotangio @guiihlopes, try router.pushRoute instead of router.push