鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ react Provider 源碼疑惑

react Provider 源碼疑惑

    

    Provider.prototype.getChildContext = function getChildContext() {
  var _ref;

  return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
};

function Provider(props, context) {
//這里的context ,哪里來的?我知道是上面getChildContext的返回值,我想知道源碼中是如何運作的,我覺得應(yīng)該是react傳遞進(jìn)來的,但是還沒有找到源碼
  _classCallCheck(this, Provider);

  var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));

  _this[storeKey] = props.store;
  return _this;
}

如上源碼:注釋處的疑問,希望各位熱衷于源碼解讀的給下回復(fù)

回答
編輯回答
淚染裳

后來自己寫了篇博客,也算是搞明白了一部分;我真是自問自答啊,尷尬
https://segmentfault.com/a/11...

2017年8月27日 12:12