How store is injected into context and passed down from Provider

During the initial mount (ReactCompositeComponent.performInitialMount), React creates the context by merging the pre-existing context and the ChildContext, which is obtained from the component’s getChildContext method.

And in Provider.prototype.getChildContext method, the store is returned.

Define contextTypes to receive some properties of the context (otherwise all properties will be filtered out before the component receive the context)

static contextTypes = {
    store: PropTypes.object

Define getChildContext along with childContextTypes to pass down values through context

static childContextTypes = {
    store: PropTypes.object
 return {store:};

Leave a Reply

Your email address will not be published. Required fields are marked *