houchaowei / houchaowei.github.io

Blog address
http://houchaowei.github.io
2 stars 0 forks source link

React Hook借助useReducer, useContext代替Redux方案 | MonkeyBlog #22

Open houchaowei opened 4 years ago

houchaowei commented 4 years ago

https://houchaowei.github.io/20191120-React-Hook%E5%80%9F%E5%8A%A9useReducer-useContext%E4%BB%A3%E6%9B%BFRedux%E6%96%B9%E6%A1%88/

当我们使用redux进行数据管理的时候,一般都是在根组件通过Provider的方式引入store,然后在每个子组件中,通过connect的方式使用高阶组件进行连接,这样造成的一个问题是,大量的高阶组件代码冗余度特别高,既然hooks带来了新特性,不如一起来用用看 目录结构图