为什么要用redux

来源:5-9 常用库集成: Reselect

Daisyfighting

2021-08-13

redux解决了状态管理问题,在一个地方集中管理,但是设置的过程复杂,使用也很复杂,那么为什么要用了?
为什么不用React Context API 和 React Hooks了?
Context provides a way to pass data through the component tree without having to pass props down manually at every level.
The React Context API is React’s way of managing state in multiple components that are not directly connected.
React Hooks provide an alternative to writing class-based components by allowing us to easily handle state management from functional components.

写回答

1回答

艾特老干部

2021-08-25

你好,Redux 不是必须要用的。对于中小型项目,context  + react hooks 的组合,也是没有任何问题的。

0
0

React16+Redux实战企业级大众点评Web App

从架构设计到部署上线,带你学习React技术栈与核心思想

1071 学习 · 306 问题

查看课程