My current solution involves an extra useState
which holds a boolean variable to signal whether it is the initial render of the component or not.
This does not seem like good practice.
What is the standard way to archive this?
I use react hooks, not classes.
const [init_render, set_init_render] = useState(true);
useEffect(() => {
if (!init_render) {
// do stuff
}
}, [dependency]);