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

Proptype for Context.Provider #223

Closed
eedrah opened this issue Sep 28, 2018 · 4 comments · Fixed by #211
Closed

Proptype for Context.Provider #223

eedrah opened this issue Sep 28, 2018 · 4 comments · Fixed by #211

Comments

@eedrah
Copy link

eedrah commented Sep 28, 2018

Is there a proptype for Context.Provider? If I use element I get the following error message:

Warning: Failed prop type: Invalid prop `ContextProvider` of type `object` supplied to `myComponent`, expected a single ReactElement.

and if I use node I get:

Warning: Failed prop type: Invalid prop `ContextProvider` supplied to `myComponent`, expected a ReactNode.
@eedrah
Copy link
Author

eedrah commented Sep 28, 2018

I just got the same thing for Consumer also. Currently I'm using object, but that seems like a shame, as that is going to match a lot more than wanted.

@ljharb
Copy link
Collaborator

ljharb commented Sep 29, 2018

Seems related to #211.

@eedrah
Copy link
Author

eedrah commented Oct 1, 2018

Agreed it will be fixed with #211, so closed in favor of that pull request

@henrik
Copy link

henrik commented Nov 4, 2021

Because it took me a little while to figure out – the thing #211 ended up adding specifically is PropTypes.elementType, which seems to work fine for a provider.

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

Successfully merging a pull request may close this issue.

3 participants