fisshy / react-scroll

React scroll component
https://github.com/fisshy/react-scroll/blob/master/README.md
MIT License
4.35k stars 436 forks source link

React Scroll is broken for newer versions of NextJs > 13.5 #567

Open JonnyDeates opened 11 months ago

JonnyDeates commented 11 months ago

After Nextjs updated to version 13.5 and above react scroll no longer works. They changed how importing works in their system, not sure if it has anything to do here on y'all's side of things, but just want to make sure people are able to track the breaking change from this. https://github.com/vercel/next.js/issues/55794

fisshy commented 11 months ago

Great catch, seems like there's no workaround atm?

If you find a solution let us know, or just submit a PR.

fisshy commented 11 months ago

Ok, I just tried react-scroll on next.js v14.0.1.

It works great for me, only change needed is to use "use client"

I also added a next.js example. https://github.com/fisshy/react-scroll/blob/master/examples/next-js/page.tsx

willTastyMakers commented 10 months ago

Hi Fisshy, In the solution above, you are not using Link's "onSetActive()" method. Have you had any success getting scrollSpy to work when Element associated with. link becomes active?

ozkanparlakkilic commented 9 months ago

Fisshi's suggestion worked in my project too.

Next JS version: 14.0.4 react-scroll version: 1.9.0

JonnyDeates commented 8 months ago

Apologies, I am using react-scroll-parallax, not react-scroll. The fix of "use client" on the component doesn't work. :/