【发布时间】:2019-02-18 20:10:12
【问题描述】:
export default class App extends Component {
...
componentDidMount() {
//registering event listener
BackgroundGeolocation.on('location', this.onLocation, this.onError);
}
onLocation(location) {
//wishing to dispatch an action to update variable in store
}
render() {
return (
<Provider store={store}>
<AlertProvider>
<MainNavigator screenProps={{ isConnected: this.state.isConnected }} />
</AlertProvider>
</Provider>
);
}
}
据我了解,我无法连接到此组件中的存储,因为我们只是在配置并将存储传递给 Provider。我怎么可能在我的onLocation 事件中调度一个动作?
【问题讨论】:
标签: reactjs react-native redux react-redux