@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! 🎉
@ccreusat
Posted
@mickyginger Thanks a lot ! I'm gonna look at this post and fix this. Same for the paragraph to avoid jumpy effect!