title: How to dispatch redux action outside of a component?
body: <p>I'm using <code>redux</code> in my <code>react-native</code> mobile app.<br>
  The communication with the backend is via websockets using <code>socket.io</code>.  </p>
  
  <p>I organize the project in a way where I have a file (you could call it an object) which initialize the socket client.<br>
  The handlers are registered to it, and I want to send actions to the <code>reducers</code>.</p>
  
  <p><code>socket.js</code>:</p>
  
  <pre><code>export function createSocket (url) {
    console.log(`connecting to ${url}`)
    // dispatch(actions.CONNECT)
    return io(url)
  }
  </code></pre>
  
  <p>How can I <code>dispatch</code> actions from those functions outside of any <code>react component</code>?</p>