react-scroll icon indicating copy to clipboard operation
react-scroll copied to clipboard

React Scroll is broken for newer versions of NextJs > 13.5

Open JonnyDeates opened this issue 2 years ago • 5 comments

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

JonnyDeates avatar Nov 01 '23 18:11 JonnyDeates

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

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

fisshy avatar Nov 01 '23 21:11 fisshy

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

fisshy avatar Nov 01 '23 22:11 fisshy

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?

willTastyMakers avatar Dec 01 '23 21:12 willTastyMakers

Fisshi's suggestion worked in my project too.

Next JS version: 14.0.4 react-scroll version: 1.9.0

ozkanparlakkilic avatar Jan 02 '24 23:01 ozkanparlakkilic

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

JonnyDeates avatar Jan 17 '24 20:01 JonnyDeates