wufe / react-particles-js

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

Can't get it to work, may be I'm making a mistake? #152

Closed 96312 closed 4 years ago

96312 commented 4 years ago

Hello all, I'm fairly new to react and want to use particles-js in my first learning project. This is my index and app JS files:

https://codesandbox.io/s/distracted-minsky-i1op8?file=/src/App.js

I have installed the package with npm install, yet nothing is getting rendered when I run it. What must I be doing wrong? :P If you can help me figure this out, I'd appreciate it.

Please and thank you.

matteobruni commented 4 years ago

Hi @96312, The particles default color is white so you won't see anything because the background color is white too.

96312 commented 4 years ago

@matteobruni Hi! Oh wow, that was kinda silly on my part. I added a black background on my index.css and it works in a spectacular fashion. Thank you and sorry for the trouble.

ps: just to make sure I'm on the right track, that is the right way to define a background for this page on react as well, amirite? I've only dealt with simple html and css in the past so I relate everything to that.

matteobruni commented 4 years ago

You can use the background options in the particles if you prefer

You can find the documentation here: https://particles.js.org/interfaces/_options_interfaces_background_ibackground_.ibackground.html

This is the link with all the options available: https://particles.js.org/interfaces/_options_interfaces_ioptions_.ioptions.html

96312 commented 4 years ago

Thanks for linking it! I struggled with figuring out the hierarchy for a second, but it all worked out at the end. Thanks a ton for helping me figure this out @matteobruni