Redux 已被移回试验环,因为我们不再将其视为 React 应用程序默认的状态管理方式。经验表明,在许多情况下 Redux 框架仍然具有一定的价值。但是与其他方法相比,Redux 会导致代码冗长难读。而引入 Redux Sagas 通常更会加剧这个问题。相对的,React 最新版本中的功能已经可以有效地管理状态,而无需引入其他框架。但需要着重强调的是,当简单的状态管理解决方案开始变得复杂时,仍然可以考虑使用 Redux,或者是 Facebook 最近发布的 Recoil。
With the increasing complexity of single-page JavaScript applications, we have seen a more pressing need to make client-side state management predictable. Redux, with its three principles of restrictions for updating state, has proven to be invaluable in a number of projects we have implemented. Getting Started with Redux and idiomatic Redux tutorials are a good starting point for new and experienced users. Its minimal library design has spawned a rich set of tools, and we encourage you to check out the redux-ecosystem-links project for examples, middleware and utility libraries. We also particularly like the testability story: Dispatching actions, state transitions and rendering can be unit-tested separately from one another and with minimal amounts of mocking.
With the increasing complexity of single-page JavaScript applications, we have seen a more pressing need to make client-side state management predictable. Redux, with its three principles of restrictions for updating state, has proven to be invaluable in a number of projects we have implemented. Getting Started with Redux and idiomatic Redux tutorials are a good starting point for new and experienced users. Its minimal library design has spawned a rich set of tools, and we encourage you to check out the redux-ecosystem-links project for examples, middleware and utility libraries. We also particularly like the testability story: Dispatching actions, state transitions and rendering can be unit-tested separately from one another and with minimal amounts of mocking.
Redux is a great, mature tool that has helped many of our teams reframe how they think about managing state in client-side apps. Using a Flux-style approach, it enables a loosely coupled state-machine architecture that's easy to reason about. We've found it a good companion to some of our favored JavaScript frameworks, such as Ember and React.