Solutionunvalidated
Move the reset logic into a useEffect (or handle reset from the parent via props) so state updates occur as effects rather than during render. In the parent, toggle the reset flag (and optionally set it back to false after the update) to trigger the child's reset without causing continuous re-renders.
1c2cd881-1d39-48ae-899a-b724d008c7b8
Move the reset logic into a useEffect (or handle reset from the parent via props) so state updates occur as effects rather than during render. In the parent, toggle the reset flag (and optionally set it back to false after the update) to trigger the child's reset without causing continuous re-renders.