useEffect(() => {
return () =>
setTimeout(() => set_current_focus(index_map[comp_index]), 1000);
}, [comp_index]);
and
useEffect(() => {
return setTimeout(() => set_current_focus(index_map[comp_index]), 1000);
}, [comp_index]);
Based on my testing, there is no difference.
Can someone confirm?