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

Invalid propType warning when rendering a Provider with no surrounding elements #1737

Closed
Tracked by #1553
rimunroe opened this issue Aug 8, 2018 · 1 comment
Closed
Tracked by #1553
Assignees

Comments

@rimunroe
Copy link

rimunroe commented Aug 8, 2018

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 expected

Expected 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
@rimunroe
Copy link
Author

rimunroe commented Aug 27, 2018

I can't reproduce the issue anymore after updating enzyme to 3.5.0 and enzyme-adapter-react-16 1.3.0. I'm going to go ahead and close this since it appears to have been resolved 🙂

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

3 participants