1. 程式人生 > >react context

react context

yun 更新 通信 child done PE DC article don

Container.childContextTypes 中進行接口的聲明,通過 getChildContext 返回更新後的state,在 Child.contextTypes 中聲明要獲取的接口,這樣在子組件內部就能通過 this.context 獲取到。通過 Context 這樣一個中間對象,ChildOne 和 ChildTwo 就可以相互通信了。

最後付個鏈接:https://segmentfault.com/a/1190000012575622

mobx核心:https://yq.aliyun.com/articles/147474?t=t1

react context