How to rerender component in useEffect Hook
Think of your useEffect as a mix of componentDidMount, componentDidUpdate, and componentWillUnmount, as stated in the React documentation. To behave like componentDidMount, you would need to set your useEffect like this: useEffect(() => console.log(‘mounted’), []); The first argument is a callback that will be fired based on the second argument, which is an array of … Read more