Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

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
Contributor

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants