Closed ctian1 closed 1 year ago
The goal of the starter is to not unmount the canvas while switching routes, it allows developers to make smooth 3D transitions while navigating between pages.
If you need to unmount or remount your canvas component I can only recommend embedding <Component.canvas />
in your page instead of at the app root.
Hooks inside of Component.canvas seem to break because the component doesn't properly unmount and remount when switching routes, and React thinks they should be the same instance. I fixed it by passing the route as a key:
<Component.canvas key={path} {...pageProps} />