Closed dbrrt closed 4 years ago
@dbrrt Hello, it's possible to use it.
It depends on what you want to do, you can dispatch Router methods from your sagas, or read the location state from the store.
Let me know if I can help you further
@danielr18 Thanks for the quick reply, I've tried to wrap my main App with <Provider>
and <ConnectedRouter>
, but it had no effect when calling actions from the library. I'm using hooks in my functional components can it be an anti-pattern with your library?
Are you using the redux middleware?
Here's v2 example: https://github.com/danielr18/connected-next-router/tree/v2/examples/basic
Yes, but probably misconfigured. Will try again. Thanks for the link!
EDIT: Quickly adapted from the example your shared. It works just fine with Saga.
Here's how I'm updating the route in my sagas in my generators.
yield put(push({ pathname: '/new-path'}))
Unfortunately I'm still having Server side rendering issues: Error: No router instance found. You should only use "next/router" inside the client side of your app.
Are you dispatching a navigation action on the server side?
That was the issue, performing the dispatch on the client side only resolved the problem
Thanks a lot @danielr18, this issue can be closed, I can try to make a PR with an example for Saga once I've got a moment.
@dbrrt That would be great, thanks!
Hello,
Is it possible to use this library in Redux Saga, if so how?
Thanks in advance.