title: Dispatch an action based on the page the user is at
body: <pre><code>const handleChangeCurrency = currency =&gt; {
  /*if(user on currencyList component page) dispatch below twos*/
          dispatch({
              type: 'currencyList/emptyCurrencyList',
              payload: []
          })
          dispatch({
              type: 'currencyList/setCurrencyListConvertedState',
              payload: true
          })
  /*if(user on currency component page) dispatch below twos*/
          dispatch({
              type: 'globalStats/setGlobalStatsConvertedState',
              payload: true
          })
          dispatch({
              type: 'currency/setCurrencyConvertedState',
              payload: true
          })
      }
  </code></pre>
  <p>Here, I have two components <code>CurrencyList</code> and <code>Currency</code>(specific) both of which render on different <code>route</code>s. But, I have a <code>CurrencyChanger</code> component which is universal i.e., is present on the whole application irrespective of <code>route</code>.
  Now, I want to dispatch some <code>actions</code> depending upon the page user is at. I don't wanna dispatch all the four actions everytime as it makes the application slow.
  Is there anything I can put inside <code>if else</code> block to dispatch them conditionally.</p>