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.
useEffectis used to listen if theselectedThemeis changed. So the function passed to the useEffect hook will be called whenever theselectedThemevariable changed.Thanks