you can maintain a state inside the component to save the latest component state. Then update the component state when only all hooks have been updated successfully.