Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about its use in combination with Next.js #169

Open
kleisberg opened this issue Jul 24, 2023 · 3 comments
Open

about its use in combination with Next.js #169

kleisberg opened this issue Jul 24, 2023 · 3 comments

Comments

@kleisberg
Copy link

hello i tried to use it with Next.js , but I couldn't get it to work. is there an example piece of code available?

@33tm
Copy link

33tm commented Aug 1, 2023

The backgrounds that use Three should have the same process as using React.

Regarding the backgrounds that use p5, I was able to use it in Next by following the same steps as React, but with some minor changes.

  • First, I added "use client" to the top of the file, to indicate to Next to run the page client-sided.
  • Then, I imported the background component just created using next/dynamic, like this:
    const Background = dynamic(() => import("@/components/background").then(mod => mod.Background), { ssr: false })
    (Make sure to change the variable name and path for your needs~~)

Hope this brings you success, I struggled with this problem too 😅

@LB22
Copy link

LB22 commented Aug 17, 2023

@treetreet0rrm0uth Do you have a working example like a repo/jsfiddle or similar? I believe I want to use NET or WAVES as the background in root layout. Would be greatly appreciated 😄

@s-alad
Copy link

s-alad commented Feb 4, 2024

  • const Background = dynamic(() => import("@/components/background").then(mod => mod.Background), { ssr: false })

Do you have an example? I deal with [VANTA] Init error TypeError: T is undefined after following your steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants