reduxjs/redux

[Docs] Add admonitions warning about tutorials teaching "redux" vs "redux toolkit"

mickremedi opened this issue · 0 comments

What docs page needs to be fixed?

  • Home Page
  • Tutorial Pages

What is the problem?

As both a new developer (1-2 years experience) and new to the redux ecosystem, I'll be the first to admit that I'm guilty of the comment made by @markerikson in his Twitter post. Essentially when I, as I'm sure many (if not most) new devs, want to learn about a way to have a global state or share state across react components, the most vocal solution is always redux, leading us to follow these next steps:

  1. Google "redux tutorial" or "redux"
  2. (sometimes) See the official redux page and click it, then go to the docs site (either the home page or the "Redux Fundamentals" page depending on what the first result is)
  3. Get "scared" at how much information there is on the docs site
  4. Click the next-closest blog or video tutorial because they look less intimidating
  5. Learn from there...

The obvious (in hindsight) flaw in this plan is that the next-closest tutorials normally use pre-toolkit redux. The only reason I noticed redux toolkit exists is that people kept complaining about the "boilerplate" and "complexity" that redux has and I had started looking for alternatives (zustand, recoil, jotai, etc).

There's definitely a larger fundamental issue with the documentation community in steps 2 and 3, where beginner devs would historically look at the docs of some library or framework only to realize that the docs don't have enough focus on the practical side of the tool versus a blog or video teaching how to make an example application with the tool. This problem might be a bit too out of scope for this little issue ticket.

Instead I want to focus on the "pre-toolkit redux tutorials" issue, hopefully getting people to come to the 2 conclusions stated in the official documentation:

We specifically recommend that our users should use Redux Toolkit (the @reduxjs/toolkit package), and should not use the legacy redux core package for any new Redux code today!

The redux core package still works, but today we consider it to be obsolete.

What should be changed to fix the problem?

Place a red "warning" admonition on the home page and at the top of tutorial pages saying something along the lines of:

The redux core package still works, but today we consider it to be obsolete. We specifically recommend that our users should use Redux Toolkit (the @reduxjs/toolkit package), and should not use the legacy redux core package for any new Redux code today! Even for existing applications, we recommend at least switching out createStore for configureStore as the dev-mode middleware will also help you catch accidental mutation and serializability errors in existing code bases. If you still want to learn outside the official docs, then unless specifically needed, please prioritize tutorials teaching Redux Toolkit as they are more likely to teach the simpler way of using redux.

(Note that I directly copied and pasted most of these sentences from the official docs)

This can hopefully catch a large handful of developers at step 2, at least sending them in a better direction when working on one of two scenarios:

  • A developer working on a brand new project who wants to implement a global state or shared state across React components
  • A developer working on an established project that is currently using the older way of redux, unaware of the existence of redux toolkit (and so won't consider that an easier way exists!)