useEffect is used to listen if the selectedTheme is changed. So the function passed to the useEffect hook will be called whenever the selectedTheme variable changed.
I am Senior Reactjs developer with 4 year of experience. Apart from freelancing work I am a mentor teaching 100's of students around the globe. I love to share knowledge regarding Reactjs.
useEffect
is used to listen if theselectedTheme
is changed. So the function passed to the useEffect hook will be called whenever theselectedTheme
variable changed.Thanks