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

"Warning: Accessing PropTypes via the main React package is deprecated" for React 15.5+ #213

Closed
lahmatiy opened this issue Oct 16, 2017 · 2 comments

Comments

@lahmatiy
Copy link
Contributor

With commit 73d6052 some import were changed to:

import * as React from 'react';

In this case babel uses _interopRequireWildcard which is using for..in to make a copy of module exports. This cause to warning when React 15.5+ is using:

Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

Because with React 15.5, importing PropTypes from React is deprecated in favour of importing from the new 'prop-types' package.

@armandabric
Copy link
Collaborator

armandabric commented Oct 17, 2017

This king of import is how flow advice to do to work with React: https://flow.org/en/docs/react/types/

This will not be an issue with React 16. And I'm not sure we could do something about it 😕 It's look like a babel issue more than an issue in our side

If someone have a suggestion I'm open 😅

lahmatiy added a commit to lahmatiy/react-element-to-jsx-string that referenced this issue Oct 28, 2017
…a#213)

Explicit import of React's types to avoid star import that leads to warning about access to PropTypes.
@lahmatiy
Copy link
Contributor Author

lahmatiy commented Oct 28, 2017

Issue fixed by PR #224
It uses specific type imports instead of *.

armandabric pushed a commit to lahmatiy/react-element-to-jsx-string that referenced this issue Oct 30, 2017
…ixes algolia#213)

Explicit import of React's types to avoid star import that leads to warning about access to PropTypes (fixes algolia#213).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants