Skip to content

I am using create-react-app for an app I am building and when I try to access PropTypes directly from React I get the following error in the console: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead. #2067

@interglobalmedia

Description

@interglobalmedia

If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.

Can you reproduce the problem with latest npm?

Yes.
Many errors, especially related to "missing modules", are due to npm bugs.

If you're using Windows, follow these instructions to update npm.

If you're using OS X or Linux, run this to update npm:

npm install -g npm@latest

cd your_project_directory
rm -rf node_modules
npm install

Then try to reproduce the issue again.

Can you still reproduce it?
Yes

Description

I am wondering whether or not you have added the npm package prop-types to create-react app, because if we still have to access PropTypes directly from React, that has been deprecated and PropTypes is therefore ineffective.
What are you reporting?
A bug/deprecation

Expected behavior

To be able to test for proper PropTypes with React.PropTypes without getting an error in the console.
Tell us what you think should happen.
If I remove something that has been set as .isRequired with React.PropTypes, that I should be notified if the type is incorrect (or non-existent).

Actual behavior

I get the following error in the console: Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead. And nothing happens when I try to create an error. It is not recognized by the deprecated React.PropTypes method.
Tell us what actually happens.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): react-scripts@0.9.5
  2. node -v: 7.8.0
  3. npm -v: 4.2.0

Then, specify:

  1. Operating system: Mac OS Sierra 10.12
  2. Browser and version: Chrome Version 58.0.3029.81 (64-bit)

Reproducible Demo

Please take the time to create a new app that reproduces the issue.

Alternatively, you could copy your app that experiences the problem and start removing things until you’re left with the minimal reproducible demo.

(Accidentally, you might get to the root of your problem during that process.)

Push to GitHub and paste the link here.
https://github.com/interglobalmedia/todo-list-create-react-app
By doing this, you're helping the Create React App contributors a big time!
Demonstrable issues gets fixed faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions