A lot of people come to redux-router having seen the redux tutorials, like the one here
http://redux.js.org/docs/api/applyMiddleware.html
Form the existing redux-router example, it's not clear at all how to achieve this. When I follow the conventional flow of binding action creators
function mapStateToProps(state) {
return {
loginState: state.login,
}
}
function mapDispatchToProps(dispatch) {
return {
loginActions: bindActionCreators(loginActions, dispatch),
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(SomeApp)
And then pass those into my router
# in the SomeApp component
<Router>
<Route name="login" component={Login} initial={true} title="Login"
login={{...this.props.loginState}}
actions={{...this.props.loginActions}} />
</Router>
The thunks will not return the function dispatch => {}. However, when the Login component is used by itself, ie
<Login login={{...this.props.loginState}} actions={{...this.props.loginActions}} />
Action creators and thunks work as before.
Now, I realize that this example is missing some crucial details (i'm happy to provide those). But all I'm saying is that there is a considerable mental gap between what the redux-router example shows and some likely use cases (at least for me).
A lot of people come to redux-router having seen the redux tutorials, like the one here
http://redux.js.org/docs/api/applyMiddleware.html
Form the existing redux-router example, it's not clear at all how to achieve this. When I follow the conventional flow of binding action creators
And then pass those into my router
The thunks will not return the function
dispatch => {}. However, when theLogincomponent is used by itself, ieAction creators and thunks work as before.
Now, I realize that this example is missing some crucial details (i'm happy to provide those). But all I'm saying is that there is a considerable mental gap between what the redux-router example shows and some likely use cases (at least for me).