rematch / rematch

The Redux Framework
https://rematchjs.org
MIT License
8.47k stars 419 forks source link

Differences between Rematch and Redux Toolkit (rtk) #735

Open Izhaki opened 4 years ago

Izhaki commented 4 years ago

No references to Redux Toolkit?

Redux Toolkit(rtk) seems to have many parallels to this project. It is an official redux project.

The documented rationale of this project seems to target conceptual and pain-points with 'classic' redux that are equally addressed by the Redux Toolkit.

So the question is: How this project differs from Redux Toolkit? I think this should be added to the docs.

On a more critical note

For sure, there are some api differences between rematch and rtk; rtk is also more opinionated (eg, immer, thunks by default). But given it brand pitch is:

The Redux Toolkit package is intended to be the standard way to write Redux logic

and given that it should get quite some traction, one may ask is it really worth maintaining this project in light of rtk?

d3dc commented 4 years ago

Rematch allows Redux to be extended with plugins that introduce "kinds" of reducers. This helps remove the boilerplate and conceptual overhead for more complex interactions.

It also uses Typescript a little differently and has been attempting to do type inference, something that has to be opinionated.

There are also some opinions baked in like strict scoping of side-effects to models - this has come up in issues before and IMHO Toolkit is a little more flexible here.

One thing I think all those things together enables, that would really differentiate Rematch, is simply exposing it's runtime through some imperative hooks. We've seen them in React core! Rematch has the ability to expose plugin level abstractions and type-safe model interfaces to reducers under it's root one.

mathieutu commented 4 years ago

I've tried rtk for a while before leaving it in favor of rematch.

I've chosen rematch because of:

And in fact, rematch is older than rtk, and has surely inspired a lot the redux team for rtk.

roryokane commented 4 years ago

This roadmap for Redux Toolkit, written in 2019-01-21, includes a short comparison to Rematch:

Some specific use cases this library [Redux Toolkit] will not address:

  • […]
  • Higher-level "frameworks on top of Redux", like rematch or kea. Again, there's some neat ideas, but they're really starting to move away from what "typical" Redux usage looks like, and adding a lot more of their own complexity on top.

Assuming Redux Toolkit’s goals have not changed since then, that comparison could be used as the basis for a comparison in Rematch’s docs.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

roryokane commented 4 years ago

This is still an issue. The README still does not mention “Redux Toolkit” or “RTK” at all.

Izhaki commented 4 years ago

Oddly, we are using RTK, but soon we'll have to port some of our system into a system using Rematch, and the question surfaced again... why Rematch?

I think it would be really useful if people can see the benefits of Rematch over RTK (and possibly vice versa).

mgutz commented 4 years ago

tldr; RTK seems to be the create-react-app for redux state---inflexible but good enough.

Just some quick thoughts after a quick use of RTK

Immer is opt-in in rematch. RTK uses immer to protect users against themselves. I see their point. We've run into bugs where an engineer did not properly immutably update state. Still, I prefer immer to be opt int for maybe the 5% of our reducer functions where performance is paramount. There does not seem to be a way to opt out of immer in RTK.

Async thunks mechanics are clunky in RTK. It's back to boilerplate! However, RTK handles fulfilled, pending and error states. I can't think of a non-trivial app where I didn't implement a solution around action statuses.

I haven't yet figured out how to handle the same action across multiple reducers in RTK.

No plugins in RTK.

I'll stick with Rematch for now. Code is simpler with Rematch than the current form of RTK. Rematch is customizable.

fantasticsoul commented 3 years ago

I've tried rtk for a while before leaving it in favor of rematch.

hey, my dear friend, have you tried concent? that will make state management much easier than u experienced before.

codefactor commented 3 years ago

To me it's a red flag that the documents don't mention a comparison to Redux Toolkit. Reading through the issue comments did give some insights, though.

semoal commented 3 years ago

To me it's a red flag that the documents don't mention a comparison to Redux Toolkit. Reading through the issue comments did give some insights, though.

Rtk was created after Rematch existence. That's why the documentation is a bit outdated related to "inspiration". We didn't take any inspiration in redux toolkit because didn't exist, I'll try to create a section on the docs about the biggest differences 👍🏻

bichotll commented 3 years ago

Was looking for that as well. A lover of Rematch and never used Rtk before and wanted to know what the story was related to that subject.

codefactor commented 3 years ago

@semoal , Thanks that would be great. I am trying to get a sense as to the activity on the project, with Redux Toolkit being around for a few years already, it gives a sense to liveliness of the project. Our team needs to standardize in all locations on some higher level Redux library, and so far RTK is winning due to it's broader adoption within the organization.

So far the comparisons I've seen seem shallow and highly subjective - e.g. someone says that Rematch is more of a "Framework" and RTK is a "Library" -- and my knee jerk reaction is to tend towards having fewer "frameworks" is better.

semoal commented 3 years ago

@semoal , Thanks that would be great. I am trying to get a sense as to the activity on the project, with Redux Toolkit being around for a few years already, it gives a sense to liveliness of the project. Our team needs to standardize in all locations on some higher level Redux library, and so far RTK is winning due to it's broader adoption within the organization.

So far the comparisons I've seen seem shallow and highly subjective - e.g. someone says that Rematch is more of a "Framework" and RTK is a "Library" -- and my knee jerk reaction is to tend towards having fewer "frameworks" is better.

Actually Rematch isn't a framework because it's less than 2kb gzipped (RTK is 10kb gzipped 😮 ) . It's just an abstraction layer that you could build on your own, Rematch was created 4/5 years ago to resolve Redux boilerplate, nowadays probably could have more sense to use RTK because the community is larger and it's a native official solution.

But Rematch offers a standard way of doing things, business logic that can be reusable, plugabble, some interesting plugins like @rematch/loading that handles promises spinners automatically, or @rematch/immer with immer.js out of the box, or reselect memoization out of the box with @rematch/select all this things with RTK are complex.

We are practically 100% percent compatible with typescript@latest on version 2.0.0@next, and We're working hard to improve the codebase to improve performance and maintainability.

And a lot of more features that has already been said like:

I don't know, I haven't used a lot of RTK, but I'm so fucking happy with Rematch to be honest.

Ps: We're working with an editorial to write a book of Rematch, so be tuned 🌞

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

roryokane commented 2 years ago

This is still an issue. Neither the README nor the website mentions “Redux Toolkit” or “RTK” anywhere.

TechAkayy commented 2 years ago

Was exploring rematch vs redux toolkit... No support for Remote-Redux-Devtools was a deal-breaker for me. It's not soo critical for most users, but please consider filling in this gap.

https://rematchjs.org/docs/recipes/redux-devtools/#remote-redux-devtools

https://github.com/rematch/rematch/issues/419

Leaving this note here for anyone visiting this thread, as this is a difference (trivial) between rematch & redux-toolkit.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

roryokane commented 2 years ago

As I wrote the last time the stale bot visited:

This is still an issue. Neither the README nor the website mentions “Redux Toolkit” or “RTK” anywhere.

This issue can be solved by editing README.md and the website to include or at least link to this documentation.

In particular, the “Redux vs Rematch” section of the website needs a third column, “Redux Toolkit”, to show what Rematch provides above Redux Toolkit.