title: How to access dynamic data inside @connect decorator of react-redux-connect?
body: <p>So, I am using react-async-connect in combination with react-redux-connect, as such:</p>
  
  <pre><code>@asyncConnect([{
    deferred: true,
    promise: ({ params, store: { dispatch, getState } }) =&gt; {
      if (!isLoaded(getState(), params.userID)) {
        console.log('it was not already loaded')
        return dispatch(loadProfile(params.userID))
      }
  
      console.log('it was indeed already loaded')
  
    },
  }])
  @connect(
    state =&gt; ({
      profile: {???},
      error: state.publicData.profile.error,
      loading: state.publicData.profile.loading,
    }),
    { initializeWithKey }
  )
  export default class Profile extends Component {
    ...etc
  </code></pre>
  
  <p>Basically, the <code>asyncConnect</code> fires an action that loads the pertinent data, and then I'm using the @connect decorator to load this data as props for the <code>Profile</code> component below. The trouble is, I want to load user profile data into my store based on the userId, so the location of the data is "dynamic". How can I access <code>params</code> or other globalState type things inside the @connect decorator?</p>
  
  <p>What I need, supposing the user's id is 1234, is something like this:</p>
  
  <pre><code>@connect(
    state =&gt; ({
      profile: state.publicData.users.1234,
      error: state.publicData.profile.error,
      loading: state.publicData.profile.loading,
    }),
    { initializeWithKey }
  )
  </code></pre>
  
  <p>Of course, that userId is in the <code>params</code> object, as well as in the route itself. How can I access this?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So I should have looked more carefully at the docs. It turns out you can pass a second <code>ownProps</code> argument, like so:</p>
  
  <pre><code>@connect(
    (state, ownProps) =&gt; ({
      profile: state.publicData.users[ownProps.params.userId],
      error: state.publicData.profile.error,
      loading: state.publicData.profile.loading,
    }),
    { initializeWithKey }
  )
  </code></pre>