react-community-tools-practices-cheatsheet
redux
react-community-tools-practices-cheatsheet | redux | |
---|---|---|
10 | 268 | |
325 | 60,471 | |
- | 0.1% | |
0.0 | 9.0 | |
over 1 year ago | 7 days ago | |
JavaScript | TypeScript | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
react-community-tools-practices-cheatsheet
- State Management in React Applications
-
How I write React after 8 years
Eh, there was entirely valid reasons for the backlash :)
Redux _was_ overused in the first couple years. The original patterns _were_ very boilerplate-y. There _are_ a lot of other good tools for varying use cases that overlap with things that people have used Redux for: Context for prop drilling, React Query / Apollo for data fetching, Zustand/Jotai/Mobx/five-million-other-libs for state management.
Redux will never be the "must use this" lib again the way it was there for a couple years.
And that's a _good_ thing, because folks should take time to think about what problems they actually need to solve in their apps and pick the tools that work best for those problems.
But it's also true that Redux _is_ still a useful tool, and that RTK has addressed the pain points in using Redux. So, still very much a viable choice today, and the positive feedback we get on RTK daily shows that.
Really, the bigger issue today is that a lot of folks don't seem to understand the technical differences, tradeoffs, and intended use cases between a lot of these tools.
I wrote an extensive post describing the differences between Context and Redux to try to help with that:
- https://blog.isquaredsoftware.com/2021/01/context-redux-diff...
I've also been trying to start up a community-driven site to list common tools for various use cases (state management, styling, build tools, data fetching, etc), to act as a resource to help clarify this sort of confusion:
- https://github.com/markerikson/react-community-tools-practic...
Sadly I haven't had time to push it forward myself due to all the other responsibilities and tasks on my todo list, but hopefully at some point we can get enough info filled in for it to be a real resources that we can point people to.
-
Redux is Poison
In fact, I am literally trying to put together a community-driven site that would list commonly used tools for use cases like state management and styling, and describe their tradeoffs, specifically because I want people to make informed decisions.
-
UIs are not pure functions of the model
Good question!
The really short answer is: mostly looking at NPM download stats, Github "depended by" numbers, and random polls on Twitter.
Which are all _horribly_ flawed metrics, but they're also all we have to go by.
I wrote a couple longer comments on Reddit a while back that went into more details on some of the numbers and the potential flaws in using them:
- https://www.reddit.com/r/reactjs/comments/lcgqnd/state_manag...
- https://www.reddit.com/r/reactjs/comments/skbyb1/the_most_po...
and unfortunately you asking me about this is tempting me to turn those comments into a blog post with some additional thoughts :)
I'll definitely agree that Redux usage has peaked in _relative_ terms, although as you can see from the download numbers it seems to still be growing in _absolute_ terms. Also it's entirely possible that fewer new projects are choosing Redux.
Then again, how do we even count "usage" in the first place? I've seen Web3 app boilerplate repos that include Redux Toolkit. If 1000 people clone that repo and play with it, how do we compare that usage conceptually vs one app using Mobx that's been around for years and has a bunch of developers working on it daily?
As I've pointed out in a number of podcasts and articles: I'm not trying to convince people they _must_ use Redux, or even that they _should_ use Redux. I just want people to be aware that modern Redux is way easier than legacy Redux, that Redux _is_ still widely used and is a viable choice, and what some of the tradeoffs are when using Redux or any other state management library.
I've actually been trying to get the community to come together and work on a centralized site that would list tools in different use cases and categories such as state management, styling, data fetching, and build tooling, describe purpose / use cases / tradeoffs for each tool, and have that as a recognized resource for people to use when researching what to use for a project. You can see the original RFC discussion and prototype site here:
- https://github.com/markerikson/react-community-tools-practic...
- https://react-community-tools-practices-cheatsheet.netlify.a...
Sadly I haven't had time to push this forward, and it needs to have more people involved and helping fill out content on the various topics (not just me).
-
Building first React project, and lost on State Management
Fortunately, we're starting to make some headway on https://github.com/markerikson/react-community-tools-practices-cheatsheet/discussions/1 ! We recently got a PR adding a page covering the three Poimandres libs (Zustand/Jotai/Valtio), someone's filling out pages on styling approaches, etc.
-
Recap from Reactathon, if you missed the conference
(I will say this is the exact kind of guidance I'd like to have in the "React Community Tools" site I still want to build out as a resource, and I'm hopeful that we can get some content filled out and momentum behind that site later this year.)
-
Should we be teaching Redux in 2022?
Early last year, I proposed creating a "React Community Tools and Practices" resource site. The idea was to provide curated written guidance on the different tools and techniques that React devs commonly use to solve various problems, describe the purpose and tradeoffs of each tool, and give some general guidance on how to decide on what tool best solves your use case.
-
React State Management
Background: https://github.com/markerikson/react-community-tools-practices-cheatsheet/discussions/1
- What are the biggest issues you see with React in its current form?
- Top libraries to know about
redux
-
A Comprehensive Guide to React State Management
Redux
-
Full Stack Web Development Concept map
redux - Redux is a key tool used in managing state across an application. This can be used with any web technology including React, Vue and Angular docs
-
State Management Nx React Native/Expo Apps with TanStack Query and Redux
Redux is a client-state library.
- Redux 101
-
The 20 most used React libraries
react-redux: A powerhouse for efficient state management and data flow control. Learn more
-
React State Management in 2024
Reducer-based: requires dispatching actions to update a big centralised state, often called a “single source of truth”. In this group, we have Redux and Zustand.
- Redux Toolkit 2.0: new features, faster perf, smaller bundle sizes (plus major versions for all Redux family packages!)
-
Redux Toolkit 2.0: new features, faster perf, smaller bundle sizes, and more
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-duping 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*
-
HTML Data Attributes: One of the Original State Management Libraries
DEV is a Rails monolith, which uses Preact in the front-end using islands architecture. The reason why I mention all this is that it's not a full-stack JavaScript application, and there is no state management library like Redux or Zustand in use. The data store, for the most part on the front end, is all data attributes.
-
Blogged Answers: My Experience Modernizing Packages to ESM
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/v5.0.0-rc.1
What are some alternatives?
use-context-selector - React useContextSelector hook in userland
zustand - 🐻 Bear necessities for state management in React
ducks-modular-redux - A proposal for bundling reducers, action types and actions when using Redux
remix - Build Better Websites. Create modern, resilient user experiences with web fundamentals.
egui - egui: an easy-to-use immediate mode GUI in pure Rust
SWR - React Hooks for Data Fetching
react-handbook - ⚛🤌 Modern approaches to architecture and feature development in React apps.
valtio - 💊 Valtio makes proxy-state simple for React and Vanilla
freeCodeCamp - freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.
swift-composable-architecture - A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
react-query - 🤖 Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue. [Moved to: https://github.com/TanStack/query]