跳到内容

状态管理

用于管理应用程序状态的工具库。

状态管理随时间变化趋势

Redux 及其继任者 Redux Toolkit 长期以来一直是最广泛使用的状态管理解决方案,但 Zustand 正在迅速获得地盘。而且由于它也是用户满意度最高的,可以说它应该被视为该类别的领导者。
Jotai
MobX
Recoil
Redux
Redux Toolkit
XState
Zustand
Effector

模式:

视图:

使用度:

使用过某个项目的受访者比例
0%
20%
40%
60%
80%
100%
2023
2024
2025
0%
20%
40%
60%
80%
100%
许多受访者根本不使用状态管理工具,这表明像 useStateuseContext 这样的第一方 API 通常足以完成工作。
0%
7%
14%
20%
27%
34%
1
0
1,271
2
1
505
3
2
778
4
3
674
5
4
346
6
5
131
7
6
43
8
7
10
9
8
2
0%
7%
14%
20%
27%
34%
调查对象百分比

其他状态管理工具库

虽然 TanStack Query 可能被认为是一个数据查询库,但它也能处理状态管理的事实使其成为该类别的一个很好的补充。
您还使用了哪些其他库来管理应用状态?
(自由提问)
多选
0%
20%
40%
60%
80%
100%
02
+1
03
-2
+3
05
+4
+7
07
+3
09
-2
-5
11
其他答案
0%
20%
40%
60%
80%
100%
受访者百分比

状态管理痛点

一个好的状态管理解决方案必须找到一个微妙的平衡:太受限,它就不会提供足够的能力被采用。太复杂,开发体验就会受到影响。
您在状态管理方面遇到了哪些痛点?
(自由提问)
多选
0%
20%
40%
60%
80%
100%
01
Excessive complexity
02
Excessive boilerplate
+1
03
Excessive Re-rendering
04
Global state management
+1
05
Configuration
+9
06
Synchronization issues
07
Overuse
+10
08
Excessive verbosity
09
10
其他答案
0%
20%
40%
60%
80%
100%
受访者百分比
State Management at Scale in React & Next.js
David Khourshid
Microsoft

State Management at Scale in React & Next.js

Solve challenging state management problems and build applications that reliably scale with your team. Recognize anti-patterns and learn complex state optimizations with data normalization, form data, and reducers.
State Modeling in React with XState
David Khourshid
Microsoft

State Modeling in React with XState

XState helps you manage both local and global component states in React. In this course, we'll be learning to model state before we code using state machines and statecharts and then use those in our app to orchestrate complex app logic.
感谢合作伙伴对我们的支持! 了解更多。