Don't write mapState functions that return the entire state value (and in that first example, the ...state isn't doing anything useful either). A connected component should only extract the bare minimum pieces of state that it needs, to avoid unnecessary re-renders when unrelated data changes.
Finally, I'd strongly encourage you to try our new Redux Starter Kit package. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once without writing any action creators or action types by hand. It just hit 1.0, and is our recommended way to write Redux logic.
Thank you for your feedback.
I wasn't expecting one of the Redux maintainers to come with feedback, but I agree with everything, this tutorial should be updated.
I'll see when I have some free time to take a look at the Redux Starter Kit package and see how I can integrate it into our project.
Once again, thank you for your time.
Kind regards,
Manu
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, I'm a Redux maintainer. A few quick bits of feedback:
mapDispatch
as a function.mapState
functions that return the entirestate
value (and in that first example, the...state
isn't doing anything useful either). A connected component should only extract the bare minimum pieces of state that it needs, to avoid unnecessary re-renders when unrelated data changes.Finally, I'd strongly encourage you to try our new Redux Starter Kit package. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once without writing any action creators or action types by hand. It just hit 1.0, and is our recommended way to write Redux logic.
redux-starter-kit.js.org
Hello Mark,
Thank you for your feedback.
I wasn't expecting one of the Redux maintainers to come with feedback, but I agree with everything, this tutorial should be updated.
I'll see when I have some free time to take a look at the Redux Starter Kit package and see how I can integrate it into our project.
Once again, thank you for your time.
Kind regards,
Manu