aksonov / aksonov/react-native-redux-router

Better docs on passing action creators to routes

Aperta
#13 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
404
Fork
44
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.