Dec 16, 2020
I can agree that with a simple example like this that would be better in a real application. It was more to illustrate the larger idea that you responded with that if you have something more complicated setting a value for a hook in useEffect typically once that code is written it doesn't change often so as you've said this can be abstracted out to improve the level of signal to noise in the component.