gabrielbull/react-router-server

Simplify fetchState

diegohaz opened this issue · 0 comments

I'm using react-router-server with redux and that's working like a charm. Thank you very much for this package.

But I always need to write this on my containers:

fetchState(null, actions => actions)(
  connect(mapStateToProps, mapDispatchToProps)(Container)
)

Since I'm rehydrating state through redux, if I got it right, the only thing I need is the done action so I can pass it to my redux actions and fetch data on server properly.

For that case, I was wondering if could be there something like withDone decorator, which just passes the done action to props:

import { withDone } from 'react-router-server'
...
withDone(connect(mapStateToProps, mapDispatchToProps)(Container))