title: Redux: access to store outside of the component
body: <p>I'm trying to get access to the store from outside of the component and subscribe it for store changes. I have separate file which I'm using to make an API call.</p>
  <pre><code>import React, { useEffect, useState } from 'react';
  import { useSelector } from 'react-redux';
  import store from '../store/store'
  
  const currentWeatherApi = {
      key: &quot;&quot;,
      base: &quot;https://api.openweathermap.org/data/2.5/&quot;
    }
  
    const API = () =&gt; {
      
      const inputValue = useSelector(state =&gt; state.inputValue);
      store.subscribe(() =&gt; {
        console.log(inputValue)
      })
  
      if(inputValue) {
        fetch(`${currentWeatherApi.base}weather?q=rzeszow&amp;units=metric&amp;APPID=${currentWeatherApi.key}`)
        .then(res =&gt; res.json())
        .then(result =&gt; {
          const temp = (Math.floor(result.main.temp));
          const tempMin = result.main.temp_min
          const tempMax = result.main.temp_max;
          const location = result.name;
          const sunrise = new Date(result.sys.sunrise * 1000).toISOString().substr(11, 8);
          const sunset = new Date(result.sys.sunset * 1000).toISOString().substr(11, 8);
          const country = result.sys.country;
          const wind = result.wind.speed;
          const pressure = result.main.pressure;
          const sky = result.weather[0].main;
        })
      }
  
  export default API;
  </code></pre>
  <p>When I try to console.log anything, nothing happens, like it's not even read. What am I doing wrong?</p>