title: React useEffect (with []) is called every time I change page (React Router)
body: <p>I prepared small demo for the problem:</p>
  
  <p><a href="https://codesandbox.io/s/react-router-v4-demo-4hrqs?fontsize=14" rel="nofollow noreferrer">Demo</a></p>
  
  <p>So I am using react-router-dom to create Single Page Application and I created standard navigation between two pages (components Page1 and Page2). </p>
  
  <p>Problem is that every time I switch between pages then useEffect hook (with empty array as second argument) is called (on demo you can see it in console). </p>
  
  <p>I would want to fetchData for each component only once and reuse that data after, no matter if user will switch between pages. Is there possibility to do it without checking some conditions inside useEffect function? It's a little confusing to me, because useEffect [] should run only once for component and it's not a case.</p>