Planets fact site in React

Solution retrospective
It was my first project using React and it was very difficult but it was very useful and I learned a lot. Please feel free to let me a feedback !
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Mod8124
Hi Good Job!
If you use react you don't have to use querySelector it's bad practice, react has its own hooks for that is called
useRef
, for exampleconst header = useRef(null); const changeColor = () => header.current.style.color = 'red' <h1 ref={header}><h1>
If you used useEffect always you need to put watch a keyword if you don't useEffect is going to render the component every time without limit
useEffect(()=>{ console.log('hola') }); //bad useEffect(()=>{ console.log('hola') },[ ]); //good, usually you put a variable if the variable change is going to console.log again
Finally, you use too many time the word props, so an easy way to use props and don't repeat that word is just to use Destructuring assignment it isn't bad but if you use too many times that word it's bad xD
const Header = (props) => { return ( <> <h1>{props.theme}</h1>) }; //bad const Header = ( { theme, color } ) => { return ( <> <h1>{theme}</h1>) }; //good
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord