Why store router on zustand if router is already available via useRouter?
I'm curious about what's the advantage / goal of storing router on zustand if it's already available via useRouter ?
https://github.com/pmndrs/react-three-next/blob/8648c93e97ac9e2dc0fdfcb6b002eb3dd0418ca1/src/pages/_app.jsx#L26-L30
https://github.com/pmndrs/react-three-next/blob/8648c93e97ac9e2dc0fdfcb6b002eb3dd0418ca1/src/helpers/store.js#L5
https://github.com/pmndrs/react-three-next/blob/8648c93e97ac9e2dc0fdfcb6b002eb3dd0418ca1/src/components/canvas/Shader/Shader.jsx#L30
https://github.com/pmndrs/react-three-next/blob/8648c93e97ac9e2dc0fdfcb6b002eb3dd0418ca1/src/components/canvas/Box.jsx#L6
I'm trying to reproduce a bug here, and I'm thinking that it's because of it.
If I use the router directly from next seems to bug some interactions because of R3F.
Hello!
It is because context is lost through the reconciler. So we have to either way forward it through context bridge or via a state manager such as Zustand.
If that answers your question feel free to close this issue. Maybe we could add a small explanation in the readme
If you just import "Router" directly instead of "useRouter" won't that fix the issues?
i.e.
import Router from 'next/router'
Router.whateverYouNeed
Hello!
It is because context is lost through the reconciler. So we have to either way forward it through context bridge or via a state manager such as Zustand.
If that answers your question feel free to close this issue. Maybe we could add a small explanation in the readme
I need to reload the page to see the dom changes every time. Is this something related to that?
latest r3f fix this