aksonov / aksonov/react-native-redux-router

Better docs on passing action creators to routes

Open
#13 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
404
Forks
44
PR merge metrics
No merged PRs in 30d

Description

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

```

The thunks will not return the function `dispatch => {}`. However, when the `Login` component is used by itself, ie

```

```

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.