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

It is not compatible with the latest Next.js.

Open KangXinzhi opened this issue 1 year ago • 11 comments

image

image

KangXinzhi avatar May 19 '23 09:05 KangXinzhi

Also confirm it doesn't work with [email protected] and [email protected]. Same error related to an undefined super expression. :(

alvis avatar Jun 01 '23 11:06 alvis

I got the same error, it disappeared after installing smoothscroll-polyfill. "next": "^13.4.1", "react-scroll": "^1.8.9", "smoothscroll-polyfill": "^0.4.4",

datvnn avatar Jun 06 '23 03:06 datvnn

I got the same error, it disappeared after installing smoothscroll-polyfill. "next": "^13.4.1", "react-scroll": "^1.8.9", "smoothscroll-polyfill": "^0.4.4",

hi, I have tried to solve this problem by adding the following code at the top of the page where you use react-scrolluse client,like this:

'use client'
import React from 'react'
import Link from 'next/link'
import { Link as ScrollLink } from 'react-scroll'

function App() {
  return (
    <div>
      xxx
    </div>
  )
}

export default App

KangXinzhi avatar Jun 06 '23 05:06 KangXinzhi

Also confirm it doesn't work with [email protected] and [email protected]. Same error related to an undefined super expression. :(

I have tried to solve this problem

KangXinzhi avatar Jun 06 '23 05:06 KangXinzhi

Can confirm adding 'use client' to the component using react-scroll will fix this issue.

morgnism avatar Jun 20 '23 03:06 morgnism

I also confirm that adding 'use client' solved the problem 👍

Ciscoo91 avatar Jun 21 '23 19:06 Ciscoo91

your solutions suggest that you are using the app router. is this also present when using the pages directory?

intuity-hans avatar Jun 22 '23 09:06 intuity-hans

I haven't tried using the pages directory, but based on the Next.js documentation, pages in the app directory are server components by default, while pages in the pages folder are client components by default. Therefore, I believe you don't need to use 'use client' in the components when using the pages folder. You can find this information in the Next.js documentation.

Furthermore, the documentation also explains why some third-party packages need to be in client components. You can read more about it here.

Ciscoo91 avatar Jun 23 '23 19:06 Ciscoo91

Is there any other similar library support for Nextjs13?

xiaojiudev avatar Aug 24 '23 09:08 xiaojiudev

Is there any other similar library support for Nextjs13?

as the previous replies said, all pages/components in Next 13 are by default server components, you have to set "use client" at the top of your component/page.

i also tried search by a different lib but no success =/

leandroruel avatar Oct 05 '23 15:10 leandroruel

Geez this new next js causing everything to break lol

samullman avatar Feb 06 '24 22:02 samullman