-
React-redux
在逻辑比较简单的时候,使用useSelector 和 useDipatch 这两个hooks去替代mapState and mapProps,并且不用connect就可以使用。在连接的function component中,不需要使用this.props -
Redux-thunk
为什么useState and useReducer不能取代redux-thunk? 因为useState and useReduce相当于之前的state声明和setState,使用于单个component中。 当多个component需要互相共享数据的时候,那么还是要使用redux-thunk.
hook出现:使用react-redux 和 redux-thunk
最新推荐文章于 2023-03-07 22:01:47 发布