React's useState and useEffect hooks are used to manage state in functional components. The useEffect hook is used to mimic the componentDidMount() function. When a value within the dependency array changes, the useEffect will be called again. This can lead to a repetitive re-render cycle. The fix is surprisingly simple.
1 Comment
Sort: