I have a component named Listener
, it's purpose is to just listen to all the native events such as when AppState
, BackPress
, NetInfo
and Geolocation
.
I have setup my root like below:
class Root extends Component {
render() {
return (
<Listener>
<Provider>{children}</Provider>
</Listener>
);
}
}
The problem here is I can not use connect
from react-redux
. Is there another way to dispatch an action or modify the store from outside the Provider scope such as Listener
on my setup?
Basically Provider
is not a normal Provider
from redux, it's my custom Provider
that I used to contain all logic in creating the redux setup in one place.
A snippet of it would be
export default class Provider extends Component {
store: Object;
constructor(props){
super(props);
this.store = createStore(....);
}
}