[bug]: UseSpring() Not firing in NextJS 14
Which react-spring target are you using?
- [x]
@react-spring/web - [ ]
@react-spring/three - [ ]
@react-spring/native - [ ]
@react-spring/konva - [ ]
@react-spring/zdog
What version of react-spring are you using?
9.7.5
What's Wrong?
UseSpring() is not firing in NextJS 14 dev environment.
Using the first example from the docs: https://codesandbox.io/p/devbox/bold-andras-ymxghg
To Reproduce
Use the NextJS 14 Starter, create a simple component with useSpring, run npm run dev
Expected Behaviour
The element should animate.
Link to repo
https://codesandbox.io/p/devbox/bold-andras-ymxghg
Apparently also the case in NextJS 13 https://github.com/pmndrs/react-spring/issues/2146
In Next 14 I was seeing a looped animation not start unless it was rerendered. I used a useEffect to toggle the pause spring prop once hydration (mounting) was complete and that made the animation start correctly even after page hard reload.
ETA: Ha, now it doesn't loop when I do a client side navigation back to the page though.