Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differences between Rematch and Redux Toolkit (rtk) #735

Open
Izhaki opened this issue Jan 2, 2020 · 18 comments
Open

Differences between Rematch and Redux Toolkit (rtk) #735

Izhaki opened this issue Jan 2, 2020 · 18 comments

Comments

@Izhaki
Copy link

Izhaki commented Jan 2, 2020

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
Copy link
Collaborator

d3dc commented Jan 2, 2020

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
Copy link
Contributor

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

I've chosen rematch because of:

  • async effects handling,
  • easier typings because of everything in models,
  • the plugin api which allows really awesome things very quickly,
  • action dispatcher directly integrated instead of actions creators (I was afraid of this one initially, but I can't do without it now)

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

@roryokane
Copy link

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
Copy link

stale bot commented May 15, 2020

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.

@stale stale bot added the wontfix label May 15, 2020
@roryokane
Copy link

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

@stale stale bot removed the wontfix label May 15, 2020
@Izhaki
Copy link
Author

Izhaki commented May 15, 2020

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).

@Izhaki Izhaki changed the title Justification of this project in light of Redux Toolkit (rtk) Differences between Rematch and Redux Toolkit (rtk) May 18, 2020
@mgutz
Copy link

mgutz commented Jun 27, 2020

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
Copy link

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
Copy link

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
Copy link
Member

semoal commented Nov 11, 2020

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
Copy link

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
Copy link

@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
Copy link
Member

semoal commented Nov 16, 2020

@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:

  • Async effects handling,
  • The plugin api which allows really awesome things very quickly,
  • Action dispatcher directly integrated instead of actions creators
    And a lot more...

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
Copy link

stale bot commented Jul 21, 2021

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.

@stale stale bot added the wontfix label Jul 21, 2021
@roryokane
Copy link

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

@stale stale bot removed the wontfix label Jul 25, 2021
@TechAkayy
Copy link

TechAkayy commented Oct 16, 2021

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

#419

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

@stale
Copy link

stale bot commented Apr 16, 2022

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.

@stale stale bot added the wontfix label Apr 16, 2022
@roryokane
Copy link

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.

@stale stale bot removed the wontfix label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants