HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
reduxjs
redux-toolkit
TypeScript2018–2023
reduxjs / redux-toolkit

redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development

8Distinct people
55Mentions
1Explicit recommenders
11.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

The official, opinionated, batteries-included toolset for efficient Redux development

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

I've been using redux toolkit's OpenAPI code generator for a side project and it's been pretty good. The documentation is a bit lacking and it could certainly use more work to…

SCUSKU used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year55 dated mentions

Observed mentions: 2018-04-11 15:51:39 UTC to 2023-12-04 14:33:19 UTC.

051015202018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 18 mentions; 2 submissions, 16 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 10 mentions; 1 submissions, 9 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC18216
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC707
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC817
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC1019
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC817
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC413

What Hacker News says

55 sources
I am _thrilled_ to announce that: Redux Toolkit 2.0 is LIVE!!! - https://github.com/reduxjs/redux-toolkit/releases/tag/v2.0.0 This major version has new features, faster perf, smaller bundle size, and removes deprecated options. It's accompanied by majors for all our Redux family packages ## RTK 2.0: - a new `combineSlices` method for lazy-loading reducers - Updates to `createSlice` to include a `selectors` field and allow defining thunks inside - Immer 10 w/ faster updates - Removal of deprecated options See the migration guide: - https://redux.js.org/usage/migrations/migrating-rtk-2 All of the Redux libraries now have modernized packaging with full ESM/CJS compat. They also ship modern JS (no transpiling for IE11), which means smaller bundle sizes. We've also done byte-shaving work to shrink the bundles (extracting error messages, de-du
Read the rest
ping imports) ## Redux core 5.0: - The TS conversion we did in 2019! - Action types _must_ be strings - `UnknownAction` as the default action type - Better preloaded state types - Internal subscription improvements - Still marks `createStore` as deprecated! - https://github.com/reduxjs/redux/releases/tag/v5.0.0 ## React-Redux 9.0: - *Now requires React 18 and RTK 2.0 / Redux 5.0* - Updates dev-mode checks - Throws better errors in an RSC environment - https://github.com/reduxjs/react-redux/releases/tag/v9.0.0 ## Reselect 5.0: - Switches to a new `weakMapMemoize` memoizer as default - Renames `defaultMemoize` to `lruMemoize` - Allows passing memoizer options direct to `createSelector` - Many TS improvements - https://github.com/reduxjs/reselect/releases/tag/v5.0.1 ## Redux Thunk 3.0: - Drops the default export and switches to named exports ( `{thunk, withExtraArgument}` ) - https://github.com/reduxjs/redux-thunk/releases/tag/v3.1.0 This has been a _huge_ year-long development effort! We're thrilled to get these improvements out. The tooling and bundle improvements will help all users, and we think the features and TS changes will improve the Redux dev experience significantly. Thank you SO MUCH to everyone who has contributed or helped test out the work! Please file bug reports for the inevitable issues that pop up post-release! but now I'm going off on a conf trip and going to take a very well-earned break from Redux work for December :)
In Redux Toolkit 2.0: new features, faster perf, smaller bundle sizes, and more
Oh hey, that's my post! (yes I spend too much time refreshing HN :) ) FWIW I did end up with a packaging combination that seems to work sufficiently. I never did fix the "FalseCJS" issue that `are-the-types-wrong` is detecting. I played with double-emitting TS typedefs, and the `tsup` tool _does_ actually have support for that now (added by Andrew Branch from the TS team). So it might be more feasible now. But ultimately I decided I was tired of messing with packaging setup and that what I've got is good enough. (hopefully) We're actually about to launch Redux Toolkit 2.0 and Redux 5.0 this week, assuming the last couple pieces come together. Here's the latest RCs - you can see the current `package.json` files in there: - https://github.com/reduxjs/redux-toolkit/releases/tag/v2.0.0... - https://github.com/reduxjs/redux/releases/tag
Read the rest
In Blogged Answers: My Experience Modernizing Packages to ESM
SCUSKU·May 31, 2023Recommendation phrase
I've been using redux toolkit's OpenAPI code generator for a side project and it's been pretty good. The documentation is a bit lacking and it could certainly use more work to make names more customizable. The generated code comes out looking very much machine generated. But I love that RTKQuery (redux toolkit query) has client side caching so that if I use a query param that was already used before, it will remember and just serve from the local cache. But it's been nice being able to make a backend change, run the code generator, and then be able to use whatever API in react. I hope this type of stuff gets developed more! [0] - https://github.com/reduxjs/redux-toolkit/tree/master/package...
In OpenAPI v4 (aka Moonwalk) Proposal
The primary issue I have with this article is that it points to redux-toolkit as having types that are done right. The same result of redux-toolkit create actions (https://github.com/reduxjs/redux-toolkit/blob/4ab8c42cb20ae1...) can be made mush simpler (see https://gist.github.com/baetheus/2e16ad4118b6fcd45e45756780e...). The only real difference between these two implementations is the simpler one doesn't overload a single function with multiple strategies for datatype creation. In my opinion, our industry is not generally exposed to type level programming or dependent types. As a result there are many popular APIs (redux, redux-toolkit, react, vue, jquery) that implement variadic and generic interfaces with many overlapping options on single functions. If the types for these interfaces had been written (or long considered) before being
Read the rest
published then the authors' might have noticed how complicated they are at the outset and perhaps decided to solve the simpler problems first and build the complexity slowly. "It is a poor workperson that blames her tools"
In TypeScript is terrible for library developers
Heh, it's amusing to see Redux Toolkit referenced here. I'm one of the two main RTK maintainers. My co-maintainer Lenz Weber is responsible for most of our TS type wizardry. Agreed that writing TS types for libs can be a pain. I actually did a talk recently on "Lessons Learned Maintaining TS Libraries" [0], where I talked about some of the techniques we used, and some possible TS changes that would be helpful for us as maintainers. As one recent example, TS made a change in a 4.8 pre-alpha that broke RTK's `createSlice` types. Lenz tried to come up with a fix, couldn't, and had to add a workaround to check what TS version is being used and specifically use an altered type. Since there _isn't_ a good way to know what TS version is being used, Lenz resorted to hacking together a new package that abuses the `typesVersions` property to defi
Read the rest
ne a different TS type for _every_ TS major+minor version combo, and then used that to decide what the RTK type should look like conditionally [1]. Another pain point is debugging type transformations. I reworked the Reselect types in 4.1.x to do a much better job of inferring the argument types for the final selector, based on the intersection of all the input selector arguments. This ended up as a monstrous type that does a types-level map + transpose + intersection [2]. It took me weeks to get this working right, and I frequently had to break it down into multiple small intermediate types to see how TS was processing each step. I know that someone on Twitter was recently working on an alternate TS type-checker based on bytecode, and they said they had some kind of a working types-level debugger [3]. Having something like that officially, where I could see each step of how TS was transforming the types, would be _hugely_ valuable. There's a couple folks like AndaristRake who are able to dig into the internals of the TS compiler itself to trace how it's interpreting the types. I definitely don't have that ability :) [0] https://blog.isquaredsoftware.com/2022/05/presentations-ts-l... [1] https://github.com/reduxjs/redux-toolkit/pull/2547 [2] https://github.com/reduxjs/reselect/blob/v4.1.5/src/types.ts... [3] https://twitter.com/MarcJSchmidt/status/1539787500788613120
In TypeScript is terrible for library developers
Agreed. I updated the blog to add an example. Copy/pasting here: I spend a decent amount of time in the redux world so `redux-toolkit` is a great library to see how types are done *correctly* in a real codebase. To be clear, they do a fantastic job with types, but the level of complexity is pretty startling. https://github.com/reduxjs/redux-toolkit/blob/master/package... That is just one example but the codebase is riddled with complex types. Also, when you look around, note the amount of types vs actual code. It's pretty common in style guides to never nest ternaries. In typescript, that's the only way to narrow types based on other types. It's a mess!
In TypeScript is terrible for library developers
We do a _lot_ of this in the Redux library repos (examples: [0] [1] [2] ). We have some incredibly complicated types in our libraries, and we have a bunch of type tests to confirm expected behavior. Generally, these can just be some TS files that get compiled with `tsc`, but it helps to have a bunch of type-level assertions about expected types. I actually recently gave a talk on "Lessons Learned Maintaining TS Libraries" [3], and had a couple slides covering the value of type tests and some techniques. [0] Redux Toolkit's `createSlice`: https://github.com/reduxjs/redux-toolkit/blob/9e24958e6146cd... [1] Reselect's `createSelector`: https://github.com/reduxjs/reselect/blob/f53eb41d76da0ea5897... [2] React-Redux's `connect`: https://github.com/reduxjs/react-redux/blob/720f0ba79236cdc3... [3] https://blog.isquaredsoftware.com/2022/05/prese
Read the rest
In Extreme explorations of TypeScript's type system
Not specifically. The general problem we were running into is: - We recommend inferring `type RootState = ReturnType<typeof store.getState>` - That type comes from the slice reducers - Thunks need a `State` type passed in so they know what `getState` returns - But if you do that _inside_ of `createSlice`, TS can't know that `RootState` type yet, because we haven't constructed the slice reducer yet Here was the PR where we tried to come up with something: https://github.com/reduxjs/redux-toolkit/pull/637 If you're seeing some other issue problem related to RTK, please go ahead and file an issue.
In React v18.0
Thanks for the feedback, and glad to hear it's working well overall! There's definitely been some prior requests for some additional functionality around `createEntityAdapter`. We tried to keep the original implementation fairly scoped. (The current code is actually a port of the `@ngrx/entity` package.) There were a couple suggestions around having the ability to specify additional sorting indices of some kind. I briefly tried to play with implementing that idea [0], but wasn't sure it was the right direction and haven't gotten back to it. We don't do anything about logic for creating new items or auto-generating IDs atm. But, we are definitely interested in any specific suggestions for API improvements or additional use cases that it would be good to cover. If this "page state" is mostly coming from the server and is primarily bein
Read the rest
g used as cached data, it might actually be a good candidate for our RTK Query data fetching and caching API [1] [2]. If on the other hand you need those for a lot of other calculations in the slices, then RTKQ probably isn't the right choice. `createAsyncThunk` specifically implements the standard "dispatch actions based on an async request lifecycle" pattern that's always been taught for Redux usage [3]. That way, you only have to provide a "payload creator" function that makes the async request and returns the data, and it dispatches the actions for you. Typically you then dispatch the thunk itself from a component, like `dispatch(fetchMyData())`. FWIW I and the other Redux maintainers generally hang out in the `#redux` channel in the Reactiflux Discord ( https://www.reactiflux.com ), and we're always happy to chat and answer questions. Please drop by when you get a chance - I'd love to discuss some of these topics in more detail! [0] https://github.com/reduxjs/redux-toolkit/pull/948 [1] https://redux-toolkit.js.org/rtk-query/overview [2] https://redux.js.org/tutorials/essentials/part-7-rtk-query-b... [3] https://redux.js.org/tutorials/fundamentals/part-7-standard-... [4] https://redux.js.org/tutorials/fundamentals/part-8-modern-re...
In Show HN: TopHat Finance – free, open, and offline
We've been trying to generally discourage Redux users from using sagas in most cases. I've always felt that they were absolutely overkill for basic data fetching scenarios, and this is even more true now that data fetching libraries like RTK Query and React Query exist. Where sagas _do_ still make sense is highly complex async workflows, including responding to dispatched actions, "background thread"-type behavior, and lots of debouncing/throttling/etc. But yes, I've heard of plenty of cases where sagas made a codebase unreadable, and it's a shame that they get so heavily pushed by some early Redux users. FWIW, I've actually been working on designing a new "action listener middleware" that we'd like to ship in an upcoming version of Redux Toolkit. It started off as very simple callbacks, but by adding a few key primitive functions like
Read the rest
`take`, `condition`, and `delay` I think we've been able to to come up with something that can handle maybe 75% of what sagas can do with a much smaller API surface and bundle size. I'd love to have you or anyone else using Redux take a look and give us some feedback on the current API design and let us know if there's other use cases it ought to cover: https://github.com/reduxjs/redux-toolkit/discussions/1648
In From Node to Ruby on Rails
Yes, absolutely, 100%. I wrote a post a couple years ago describing my journey learning and using TS, with a set of takeaways at the end: https://blog.isquaredsoftware.com/2019/11/blogged-answers-le... I said then that "I refuse to write any more app code that isn't TS", and that's even more true today. TS is not perfect. It does add overhead. But, it adds a huge amount of value and safety to your app. The goal is to use it pragmatically, such that Value > Overhead. *edit* I'll add a bit of additional context here based on my experiences since then. Typing application code is usually relatively straightforward. I'll use React and Redux as an example, because that's A) what I use at work, and B) I maintain Redux. Per our Redux TS Quick Start page [0], you'd start with a few lines to infer the TS types of `RootState` and `AppDispatch` fro
Read the rest
m the store, and create pre-typed React-Redux hooks (which are _much_ easier to type than the legacy `connect` API) to save from repeating those types in components. For each slice reducer, you'd add a TS type for the slice's state, and declare the type of each action's contents as `action: PayloadAction<string>`, etc. For React components, add a type declaration for the props of each component, and add types to function arguments as necessary (change handlers, etc). The React TypeScript CheatSheet [1] is a fantastic resource for learning how to use TS + React together. Also be sure to type any data coming into the system, such as API responses, and any other "business logic" you might have. Those should get you 80%-ish types coverage without too much effort, and all you really need to know is how to declare types for objects+primitives, and a few bits from the React and Redux lib types. I also strongly disagree with many of the "recommended" TS-related linting rules, like "always declare a return type for every function". It's not _wrong_ to have those, but in my experience TS works best when you can let the compiler infer as much as possible. I still firmly believe that for _app_ development, it's not worth spending hours and hours arguing with the compiler to come up with a "perfect 100% correct" type definition for more complicated scenarios. If you know that a function takes `TypeA` as an input and returns a `TypeB`, but there's really complex transformations inside and it's really hard to convince the compiler what you're doing is correct, feel free to do whatever `as` casting or `// @ts-ignore` you need to in the middle. Library types, on the other hand, are the opposite case. Library APIs are often highly generic in both the "use case" and "TS types" senses. There, it _is_ worth spending the time to come up with very complex typedefs with tons of generics and conditional types, because those are often needed to make the _end user experience_ a lot easier. Try looking at the types for Redux Toolkit, React-Redux, or Reselect [2] [3] [4] - our types are complex, so _your_ code doesn't have to be. I spent a ton of time just yesterday trying to make improvements to the Reselect types, because as a maintainer I want our users to have a good experience. But for you as an app dev, it should be a lot simpler. The payoff is that you get all the nice benefits of TS: static detection of common errors like typos and mismatched fields, documentation of your data structures, intellisense, confidence in refactoring, less need to write repetitive "is this argument the right type?" logic, and much more. [0] https://redux.js.org/tutorials/typescript-quick-start [1] https://react-typescript-cheatsheet.netlify.app/ [2] https://github.com/reduxjs/redux-toolkit/blob/v1.6.2/package... [3] https://github.com/reduxjs/react-redux/blob/v8.0.0-alpha.1/s... [4] https://github.com/reduxjs/reselect/blob/v4.1.2/src/index.ts...
In Ask HN: Is it worth it to invest in learning TypeScript?

Showing the 15 most recent of 55 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.