React useEffect is not triggering on route change
The useEffect is not triggered because the App component is not re-rendered, nothing changed in that component (no state or props update). If you want the App component to re-render when the route change, you can use the withRouter HOC to inject route props, like this : import { Switch, Route, withRouter } from ‘react-router-dom’; … Read more