react 组件化

组件传值:

ContextType (class component)

useContext (functional component)

Consumer 

Props

注意:Object每次值都不一样, 影响性能, 不要传入对象, 但可以传成state.value, 多个context value影响性能;

context适合通信,跨层级和频繁切换

HOC:概念: 参数是组件,返回值也是组件

used with function component

antd 3 vs 4, Form value from store

猜你喜欢

转载自www.cnblogs.com/connie313/p/13192632.html