I'm writing a redux app and I ran in to a small but nagging question. Why is the convention to separate the mapDispatchToProps and mapStateToProps methods? Why not just have one:
mapToProps = (state, dispatch) => {
...
}
Because the mapDispatchToProps
doesn't need to be recompiled when the state change (it's only called once).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With