Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Planets fact using ReactJS

P
Clément Creusat• 1,675

@ccreusat

Desktop design screenshot for the Planets fact site coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


It's done ! Built with ReactJS, Flexbox, Custom properties and Styled Components ! I'll really be glad to have feedback especially on the right way to handle State const in UseEffect (warning => missing dependencies)

Third time using Styled Components instead of Sass or Pure CSS. I don't know if it takes a while to get used to it but I find it really takes a long time to write my CSS that way. Next time I will bring TailwindCSS :)

Community feedback

Mike Hayden• 1,005

@mickyginger

Posted

Hey Clément this looks great!

The useEffect hook in React will call the callback method every time one of the dependencies updates, so for example:

useEffect(() => {
  console.log(newImageSrc)
}, [])

In the code above newImageSrc will be logged to the console only once (on page load), and you may get a warning about missing dependencies.

useEffect(() => {
  console.log(newImageSrc)
}, [newImageSrc])

In this example the newImageSrc will be logged every time it changes. By putting the variable in the dependency array you are telling useEffect that it is a dependency. Any variable or method that is used inside the useEffect callback is a dependency and should be included in the array.

However you may not always want that (perhaps you only want the callback to be triggered when some of the dependencies change). There are several ways to handle that case outlined in this StackOverflow post

Aside from that, it might be nice to fix the height of the main descriptive paragraph, so that the links don't move around as you are interacting with the site.

I hope that's useful, and well done on the challenge! 🎉

2

P
Clément Creusat• 1,675

@ccreusat

Posted

@mickyginger Thanks a lot ! I'm gonna look at this post and fix this. Same for the paragraph to avoid jumpy effect!

0
P
Patrick• 14,325

@palgramming

Posted

Congrats on being the first person to upload a attempt at this #GoodJob

1

P
Clément Creusat• 1,675

@ccreusat

Posted

@palgramming Thanks man but I think I am the third person to upload it #private :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

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