wufe / react-particles-js

Particles.js for React
https://rpj.bembi.dev/
MIT License
1.15k stars 106 forks source link

Nextjs - Window is not defined #109

Closed amirizzudin4 closed 4 years ago

amirizzudin4 commented 4 years ago

im trying to use this packages in nextjs but i got error saying window is not defined

wufe commented 4 years ago

This should be fixed in v3.0.2

amirizzudin4 commented 4 years ago

I manage to import react particle js in client side rendering following this example

import dynamic from 'next/dynamic';

const Typewriter = dynamic(
    () => import('typewriter-effect'),
    {
        ssr: false
    }
)
ktjd123 commented 3 years ago

I think it's not fixed yet. Css breaks when loaded over ssr. Thanks

matteobruni commented 3 years ago

This works, can you try with this configuration?

https://codesandbox.io/s/sad-goodall-ml4r9?file=/pages/index.js