-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Invalid propType warning when rendering a Provider with no surrounding elements #1737
Copy link
Copy link
Closed
Description
Describe the bug
When rendering a Provider and its Consumer directly (with no surrounding elements), a propType warning gets emitted.
To Reproduce
Steps to reproduce the behavior:
import React from 'react';
import ReactDOM from 'react-dom';
import { mount } from 'enzyme';
const { Provider, Consumer } = React.createContext();
const element = (
<Provider value="hello world">
<Consumer>{greeting => greeting}</Consumer>
</Provider>
);
ReactDOM.render(element, document.createElement('div')); // No warning, renders as expected
mount(element); // renders as expected, but yields the following warning:
/*
Warning: Failed prop type: Invalid prop `Component` supplied to `WrapperComponent`.
in WrapperComponent
*/
mount(<div>{element}</div>); // No warning, renders as expectedExpected behavior
I'd expect no warning to be emitted.
Desktop (please complete the following information):
- OS: macOS 10.13.6
- Versions:
- Node 8.11.3
- react 16.4.2
- react-dom 16.4.2
- enzyme 3.4.0
- enzyme-adapter-react-16 1.2.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels