gabrielbull / react-router-server

Server Side Rendering library for React Router v4.
MIT License
434 stars 17 forks source link

Simplify fetchState #24

Closed diegohaz closed 7 years ago

diegohaz commented 7 years ago

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))