Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Awesome, glad to hear that Redux Toolkit is working well for you!

Any feedback on using it, or things you'd like to see us try adding to RTK?



I'm a big fan of RTK, especially the immutable state out of the box. The biggest issue I had with onboarding was that the docs are geared toward users who already use and are familiar with Redux, React, and React-Redux (the first line in the tutorial even says to go read those docs first).

I completely understand the stance to not want to replicate documentation, but I also feel that RTK's opinionated approach, and tooling that is built in, satisfy most use cases of React-Redux apps. So I do wish that RTK was given more weight than plain React-Redux and had a smoother onboarding experience.

As an example, Create React App is a similar "batteries-included", and the docs for React have a direct tutorial on how to get started with CRA in their docs, while the Redux documents just mention Redux Toolkit at a high level in the Getting Started with Redux and then link you to the tutorials, which then tell you to go back and read the Redux docs to understand the concepts.

The problem we ran into is that we read about RTK early on in learning Redux, but didn't understand the concepts enough to know how much easier RTK was to use and maintain, so we built the whole app on plain Redux, then ended up having to convert it and strip out a bunch of manual code later. I think a focus on the onboarding to RTK should be emphasized. I really can't imagine a situation where anyone would be better off not using RTK unless they were after a very small bundle size, but it's pitched a sort of an "optional" kind of thing. I'd rather you be opinionated and tell me I should really use RTK and not write stuff myself, then link me to a guide that doesn't assume I know anything about Redux and doesn't start with converting an existing Redux app, but just teaches the Redux concepts in a "clean-room" where you don't assume I know anything about Redux.

Again, I LOVE RTK and all the work you all put into it is greatly appreciated. But a slightly better educational flow on the reason I would want RTK could have saved us a month or two of dev time rebuilding everything on top of RTK at the tail end when we got familiar with Redux and realized all the issues we were creating by not using immutable updates, slices, thunks, consistent actions w/ automatic action creators, memoized selectors, integration with TypeScript, etc.


Thanks, appreciate the feedback.

The good news is that I have been working on a new "Quick Start" tutorial for the Redux core docs [0], which is _exactly_ what you're describing there: an intro to Redux, for folks who have never used it before, which teaches RTK and the React-Redux hooks APIs as the default way to write Redux logic.

We also have an open issue to discuss reworking the RTK tutorial sequence [1], as there's agreement that the current RTK tutorials focus too much on migration, and the "Advanced" tutorial shouldn't include TS usage.

As I said in that issue thread, it's very hard to know how to split the onboarding flow and explanations between the Redux core docs and the RTK docs. RTK _does_ work best when you actually understand how plain Redux works and how to write Redux code "by hand", and can see the benefits and purpose of abstractions like `createSlice`. So, yeah, ideally everyone would go through the bottom-up Redux tutorial sequence at some point so they fully appreciate what RTK is doing for them.

On the other hand, it's true that RTK is a lot simpler to use, code-wise, and that there's less syntax to confuse people if they're getting started. Problem is, you still need to know concepts like "dispatching actions", "reducers", and "immutability", even if you're jumping straight into RTK.

So, bottom line: this new "Quick Start" tutorial covers exactly that "start Redux with RTK as the default" use case you're describing, and after that's done, my next task will be to rewrite the existing Redux core tutorial sequence. It'll still be a "bottom-up / how it all works by hand" approach, but updated to remove outdated content (like references to "Flux") and show simpler patterns (inline action type strings, "todos/todoAdded" instead of "ADD_TODO", single-file Redux "ducks" logic, etc).

I still don't have a good answer for how to handle the RTK tutorials, but I'm going to paste your feedback into that linked thread, and would appreciate any other suggestions you have in that regard.

[0] https://deploy-preview-3740--redux-docs.netlify.app/tutorial...

[1] https://github.com/reduxjs/redux-toolkit/issues/371


thank you for spending the time to write this. I'm new to React and starting with hooks, but if I need more I will look into RTK first.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: