You probably don't need useEffect for that
useEffect is for synchronizing your component with something outside React: the network, the DOM, a subscription. Most of the effects I see in code reviews are doing neither. They are computing values
testingab.hashnode.dev2 min read