brocoders / redux-async-connect

It allows you to request async data, store them in redux state and connect them to your react component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access props in reduxAsyncConnect function?

greyvugrin opened this issue · comments

Following the example from the docs, but can't seem to get access to props at this stage.

static reduxAsyncConnect(params, store, helpers) {
    const {dispatch, getState} = store
    console.log(this)
    const { videoId } = this.props
    if (!isLoaded(getState())) {
      return dispatch(getVideo(videoId))
    }
  }

Unless I'm missing something and you would have to provide a videoID in some other way? Are props just not available at this point?

Tried hard coding the ID for now, now running into ReferenceError: isLoaded is not defined

Disregard this, for anoyone wondering, isLoaded is BYOF (build your own function). Check out https://github.com/erikras/react-redux-universal-hot-example/blob/master/src/containers/Widgets/Widgets.js for an example.