I know that in React you can pass an empty array to make useEffect()
only run on initial load:
useEffect(() => {
// something done once
}, []);
Now my question is, should I do everything I need under one initial useEffect
:
useEffect(() => {
// something done once
// something else done once
}, []);
or can I separate them out:
useEffect(() => {
// something done once
}, []);
useEffect(() => {
// something else done once
}, []);
And if I can use either, does it matter which I choose (performance, readability, best practices).