Skip to content

TypeError: React.PropTypes is undefined. Migrating 2.3 -> 2.4 #825

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

Closed
thorstenhirsch opened this issue Nov 1, 2017 · 1 comment · Fixed by #830
Closed

TypeError: React.PropTypes is undefined. Migrating 2.3 -> 2.4 #825

thorstenhirsch opened this issue Nov 1, 2017 · 1 comment · Fixed by #830
Assignees
Milestone

Comments

@thorstenhirsch
Copy link

After upgrading from 2.3.1 to 2.4.0 my react components don't work anymore. In the console I get the following error:
TypeError: React.PropTypes is undefined
I've already seen that React.PropTypes has been deprecated and is now in its own module (prop-types), but downloading prop-types.min.js and including it before including react_ujs did not solve the problem. I guess the following statement needs to be added now:
var PropTypes = require('prop-types');

@BookOfGreg
Copy link
Member

BookOfGreg commented Nov 1, 2017

I'm afraid so. You could stay on 2.3.1 for now but yes eventually you will have to handle the prop-type issue.

https://reactjs.org/blog/2017/04/07/react-v15.5.0.html#migrating-from-reactproptypes

I have a codebase that's several thousand likes of JS, for me it was every file require 'prop-types' and global find replace React.Prop -> Prop

Are you using Webpack or Sprockets?

For Sprockets:: The pre-bundled sprockets has prop-types already included for convenience: https://github.com/reactjs/react-rails/blob/master/react-builds/react-browser.js#L4

For Webpacker:: You can safely re-run bundle exec rails webpacker:install:react and it will yarn add prop-types for you. https://github.com/rails/webpacker/blob/master/lib/install/react.rb#L26

@BookOfGreg BookOfGreg changed the title TypeError: React.PropTypes is undefined TypeError: React.PropTypes is undefined. Migrating 2.3 -> 2.4 Nov 1, 2017
@BookOfGreg BookOfGreg added this to the 2.4.1 milestone Nov 3, 2017
@BookOfGreg BookOfGreg self-assigned this Nov 3, 2017
@BookOfGreg BookOfGreg mentioned this issue Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants