Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required prop 'context.store' and 'store' failed propType #864

Closed
itaied246 opened this issue Sep 20, 2016 · 5 comments
Closed

Required prop 'context.store' and 'store' failed propType #864

itaied246 opened this issue Sep 20, 2016 · 5 comments

Comments

@itaied246
Copy link

I have cloned the repo and checked out to redux branch. Then I hit npm install and npm test and I get the following error:

Warning: Failed propType: Required prop `context.store` was not specified in `App`.
Warning: Failed propType: Required prop `store` was not specified in `Provider`.

Any thoughts on that?

Also, trying to merge redux branch into master resulted conflicts.

@lucasavila00
Copy link

I'm also having issues using the redux branch.

@granda
Copy link

granda commented Oct 17, 2016

I submitted PR #921 for consideration on an appropriate way to handle creating a mock store to pass the test.

@ghost
Copy link

ghost commented Feb 3, 2018

@langpavel

I was looking into why setting the context in client.js/server.js did not propagate down to my children components.

client.js

// Global (context) variables that can be easily accessed from any React component
// https://facebook.github.io/react/docs/context.html
const context = {
  color: 'purple',
  // Enables critical path CSS rendering
  // https://github.com/kriasoft/isomorphic-style-loader
  insertCss: (...styles) => {
    // eslint-disable-next-line no-underscore-dangle
    const removeCss = styles.map(x => x._insertCss());
    return () => {
      removeCss.forEach(f => f());
    };
  },
};

App.js

const ContextType = {
  color: PropTypes.string.isRequired,
  // Enables critical path CSS rendering
  // https://github.com/kriasoft/isomorphic-style-loader
  insertCss: PropTypes.func.isRequired,
  // Universal HTTP client
  fetch: PropTypes.func.isRequired,
};

If you inspect, say, the Home.js component, the context object is empty. I did notice that the WithStyles wrappers had context, namely "insertCss" property with a function. Do you suppose these conflict with the App-level context?

@ghost
Copy link

ghost commented Feb 3, 2018

Ah, never mind, I just realized that I need to specify the child component's "contextTypes" static property.

@langpavel
Copy link
Collaborator

This should be fixed. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants