erikras / multireducer

A utility to wrap many copies of a single Redux reducer into a single key-based reducer.
MIT License
422 stars 23 forks source link

load data with multireducer actions for deferredFetch on server #97

Closed thecaddy closed 8 years ago

thecaddy commented 8 years ago

I have a multireducer and i want to populate it on the server, not quite sure how to get the actions from the multireduced store.

export default combineReducers({
  router: routerStateReducer,
  multireducer: multireducer({
    a: store,
    b: store,
    c: store
  }),
})
import {load} from 'redux/modules/store'

function fetchDataDeferred(getState, dispatch) {
  //how to load data for multireducer stores
}

@connectData(null, fetchDataDeferred)
class blah extends Component { ... }
yesmeck commented 8 years ago

Hello, I'm working on a new version of multireducer, in the new version you can do this:

import { wrapDispatch } from 'multireducer'
import { fetch } from './actions'

function fetchDataDeferred(getState, dispatch) {
  return wrapDispatch(dispatch, 'a')(fetch);
}
yesmeck commented 8 years ago

As v3.0.0 released, I'm closing this issue, feel free to reopen this issue if you have any questions.