Skip to content
Advertisement

Tag: reactjs

Whats the best way to add an SVG to ReactJS

I want to create a component that displays an SVG in React. I am not having any luck, does anyone know a good practice for turns SVG’s into React components. I tried adding them to <img /> tags and <svg /> tags but i keep getting a broken image icon? Answer the best practice that I have found is that

how to import child’s state to parent component

I want to import the child state to my parent component in order to change DOM, but I don’t know if its possible or how to do it shall I use Redux in this case ?? if not what possibly I must do to do that Answer You can create state in parent component and pass it to child component

404 on page refresh in NextJS with p5.js

I’m using the react-p5 library for generating PerlinNoise wave animation in my about page. When I use the p5 on any page it returns a 404 page, but if click back to the home page and open about.js using the link it will work. After refresh, it won’t work. Everything works if I remove the p5 component from the file.

Advertisement