Answer the question
In order to leave comments, you need to log in
Is it possible to decorate redux connect or how to unsubscribe from redux store?
Passing props (storeName) to the component
in the component I would like to subscribe to the store with the name I passed i.e. (this.props.reducerName)
for an example of how I would like it to look<MyComponent reducerName="city" />
export default connect(state => ({
some: state[this.props.reducerName]
}), { })(MyComponent);
componentDidMount() {
store.subscribe(() => {
this.setState({some: store.getState([this.props.reducerName]});
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question