Discussion: Debate changing Redux packages to merge "Redux" and "RTK", again #4326
Replies: 7 comments 6 replies
-
I don't think we should. My main reason for thinking that way is bundle size. RTK is ~10x the size of Redux: https://bundlephobia.com/package/[email protected] For those not using RTK, that puts a lot of bytes into their projects. That feels especially weird after we've done things like #3920 to really cut down on library size. I'm totally fine with merging the repos under a monorepo, though. That might even be a good idea (less redundant tooling, more alignment on releases, better community visibility). It would no doubt be a lot of work, but I think could be beneficial. |
Beta Was this translation helpful? Give feedback.
-
Why not emit warning message when developers are calling createStore? function createStore(args, shouldWarning = true) {
if (process.env.NODE_ENV !== 'production' && shouldWarning) {
console.warning('...prefer to use @reduxjs/tooltik [url link]...');
}
} The developers will always open the |
Beta Was this translation helpful? Give feedback.
-
Merging feels natural and would be a step towards simplification - and simplification is a good thing in a generally complex ecosystem such as the one of JS frameworks/React/Redux. I hope it happens. |
Beta Was this translation helpful? Give feedback.
-
Personally, I would like to be able use redux without RTK. I appreciate redux simplicity - few concepts and code written near plain (java|type)script. I prefer it over complex opaque machinery. (Similar reasons once led me to prefer react over angular). Bigger codebase can tend to change more frequently. Also dependencies like Immer sometimes means to deal with issues. Redux makes perfect sense standalone. RTK is advertised enough. I'm for the freedom not to use it. |
Beta Was this translation helpful? Give feedback.
-
I just want to offer some feedback as a long time Redux user who saw the deprecation method. It caught me by surprise, and was very confusing because:
I do not think that marking createStore as "deprecated" and providing a legacy alias is appropriate here because:
What I feel should have happened is:
This would have been a much more familiar and friendlier approach. I've already gone thru a dozen packages that have transitioned to a |
Beta Was this translation helpful? Give feedback.
-
I appreciate your taking the time. I think the reason why it took so long to notice is because the createStore call is wrapped in a root level helper that is seldom looked at or changed. I recently visited that section of the code because we're in the process of implementing i18n, and I had to update that section. I guess the reasons I would have preferred a npm install message is because:
The reason we haven't upgraded Redux in a while is because we consider it a simple lightweight library. It's not something that needs to change because of browser updates. So simple in fact we built our own purpose built tools around it. While I understand the desire to create an easier path for newcomers, I see the old api as low level, and perfectly acceptable to use if you have established patterns in place. At least this is how I feel about it right now. I haven't had a chance to fully evaluate this new pattern and how it would fit into our ecosystem. What we have now is very much purpose built. Our system is very similar to React in how you have a component tree that mirrors the dom, and has a render cycle and flushes all the changes. We have a state component tree that performs specific operations (or "steps") in response to a Redux action, and when all the operations are complete, it "merges" the changes out, minimizing parent object recreation (being that object are immutable). Each component is very specific, and put together like legos (user-built). It could be the new pattern might work well, I just haven't had a chance to dive in and see where the overlap is, and how we would utilize it. |
Beta Was this translation helpful? Give feedback.
-
I don't know if its feasible, but I would prefer having:
|
Beta Was this translation helpful? Give feedback.
-
THIS IS STILL AN ALMOST ENTIRELY HYPOTHETICAL DISCUSSION PLEASE DO NOT PANIC
Back in late 2018, we had a thread debating the idea of "should we move this new 'Redux Starter Kit' thing into the
redux
core package?":The conclusion out of that thread was "no, we shouldn't, because there's too much ecosystem inertia and we don't want to disturb things".
So, as of today, we still have a
redux
core package with the primitive APIs (createStore
,combineReducers
), and a@reduxjs/toolkit
package that is our recommended set of APIs for using Redux today (configureStore
wrappingcreateStore
,createSlice
generating action creators and using Immer for immutable updates, etc).Over the last couple days we've been debating the idea of marking
createStore
as "deprecated", with a specific goal of driving awareness of RTK for learners who are today learning legacy Redux patterns from old tutorials, courses that were never updated, and bootcamps:createStore
as deprecated #4325As part of those discussions, the question of "well why don't you just merge
@reduxjs/toolkit
intoredux
?" has come up again. So, I wanted to open up the floor to re-litigate that particular discussion, in 2022, with what we know today about how RTK has been adopted and received.And for some examples of how people view RTK today, see:
Background
For additional background on how RTK was created in the first place, please see these posts and threads:
I'll particularly quote key sections of the "Vision" post:
My Thoughts on Why I Don't Want to Merge Packages
Stating it here at the beginning: my current opinion is that I don't want to try merging the packages. There's several reasons:
@reduxjs/toolkit
". All our docs and templates do that. I don't want to whiplash through another package name change.enableES5()
plugin on import of RTK to ensure compatibility with earlier versions of RTK+Immer before that behavior got split out. That means Immer is always in the bundle as soon as you import from RTK. Now, in practice we expect everyone using RTK will use Immer. But someone who just wantscreateStore
would now have that in the bundle too. (Note that this issue is planned to be fixed in RTK 2.0, when we would stop turning on the ES5 plugin by default and thus Immer would tree-shake correctly.)BUT... I want to actually discuss this out loud with the community and see what people's thoughts are.
Questions
Beta Was this translation helpful? Give feedback.
All reactions