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