title: How to unsubscribe from redux store when component will unmount? How to decorate redux connect?
body: <p>I am passing the following props (storeName) to my component:</p>
  
  <pre><code>&lt;MyComponent reducerName="city" /&gt;
  </code></pre>
  
  <p>and I want to connect to store with a dynamic name (this.props.reducerName)</p>
  
  <p>for example</p>
  
  <pre><code>export default connect(state =&gt; ({
      some: state[this.props.reducerName]
  }), { })(MyComponent);
  </code></pre>
  
  <p>How to decorate redux connect, or what i must to do?</p>
  
  <p>I tried to skip redux connect and used store.subscribe</p>
  
  <pre><code>componentDidMount() {
      store.subscribe(() =&gt; {
          this.setState({some: store.getState([this.props.reducerName]});
      });
  }
  </code></pre>
  
  <p>But when I move to another page, I see the following error:</p>
  
  <blockquote>
    <p>Warning: setState(...): Can only update a mounted or mounting
    component. This usually means you called setState() on an unmounted
    component. This is a no-op.</p>
  </blockquote>
  
  <p>How to unsubscribe from redux store when component will unmount?</p>