Kea: Production Ready React State Management
kea.js.org
kea.js.org
very odd tagline... are you implying other state mgmt libs are not production ready? do you not have another quality or feature that makes you stand out?
landing page has no code sample - too marketingey. only thing i get out of it is that its built atop redux.
kea-typegen looks cool. good solution to what would have been a nightmarish typing problem.
how do you compare with redux toolkit + RTK query?
Kea's main selling point is that it lets you define self-contained chunks of Redux logic. Initially, this is similar to RTK's `createSlice`, in that you're writing a set of "case reducers" + action creators. However, it also builds in Redux-Saga as a general-purpose side effects approach, and lets you write "listeners" that respond to dispatched actions. (Edit: after re-reading the latest docs, looks like sagas are now an optional plugin, and "listeners" are a sort of super-thunk of some kind.)
Where it particularly differs from RTK is in the amount of abstraction included. RTK tries to stay "visibly Redux" [0], and the abstractions are fairly thin - the focus is on simplifying the typical Redux code patterns, without hiding the fact that you're using Redux. Kea is much more heavily abstracted. It does use a number of Redux terms ("actions", "reducers", etc), but the code that you write looks noticeably different than a "typical" Redux app. Also, RTK focuses on thunks as the default async approach, rather than sagas [1]
I believe Kea also has some mechanisms for combining together those "logic" chunks in various ways, including doing so dynamically at runtime, and it appears to have some "lifecycle"-type callbacks for handling when those chunks get mounted and unmounted.
RTK Query [2], on the other hand, is a purpose-built data-fetching abstraction, most similar to React Query and Apollo. Its only purpose is to fetch data from whatever URL endpoints you've defined, handle the loading state, update the cache with the results, and re-render whatever components care about that data. (Note that RTK Query was originally published as a standalone for development purposes, but we're in the process of merging that back into RTK itself, and have it available in the RTK 1.6 alphas right now [3]).
I haven't actually used Kea myself, but it does appear to have some meaningful thought and development put into it. I would still recommend RTK as the default approach for anyone wanting to use Redux (and of course I'm biased there), but Kea has some interesting approaches.
[0] https://blog.isquaredsoftware.com/2019/10/redux-starter-kit-...
[1] https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...
[2] https://rtk-query-docs.netlify.app
[3] https://github.com/reduxjs/redux-toolkit/releases/tag/v1.6.0...
See these links for comparison discussions and info:
- https://rtk-query-docs.netlify.app/introduction/comparison
- https://www.reddit.com/r/reactjs/comments/mggpr7/rtk_query_v...