alvarotrigo / react-fullpage

Official React.js wrapper for fullPage.js https://alvarotrigo.com/react-fullpage/
GNU General Public License v3.0
1.28k stars 179 forks source link

Example code for Nextjs 13/14 #427

Closed levipadre closed 11 months ago

levipadre commented 11 months ago

Big fan of fullpage.js for ages, keep up the good work.

Do you have an example for Next.js 13 or 14 with App Router? First time I'm using the react version.

I don't know if I should add the code into layout.tsx or page.tsx. I assume it should go into layout.tsx so the sections can be the pages maybe: https://nextjs.org/docs/app/api-reference/file-conventions/layout#children-required Unfortunately, I always get this error:

Server Error
Error: Class extends value undefined is not a constructor or null

Please provide an example as soon as possible. Thanks!

Versions

Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 Binaries: Node: 18.17.0 npm: 9.6.7 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 13.5.1 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: N/A Next.js Config: output: N/A

Exquitas commented 11 months ago

Put 'use client' In the very first line in your code (above the imports), then it should work.

https://nextjs.org/docs/app/building-your-application/rendering/client-components#using-client-components-in-nextjs

levipadre commented 11 months ago

Oh, yeah. How stupid of me. Thanks @Exquitas. I created a component with 'use client' and imported on the page.tsx and it workes like a charm. Cheers!

alvarotrigo commented 11 months ago

Thanks for the response @Exquitas ! 👍