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: A Component: React.createClass is deprecated #881

Open
rinama opened this issue Jul 16, 2017 · 14 comments
Open

Warning: A Component: React.createClass is deprecated #881

rinama opened this issue Jul 16, 2017 · 14 comments

Comments

@rinama
Copy link

rinama commented Jul 16, 2017

After upgrading om to version "1.0.0-beta1", the following error is printed in the console (in development mode only)
react.inc.js:3287 Warning: A Component: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.

@danielstockton
Copy link

It's coming from here.
Other projects e.g. reagent solved it by depending on cljsjs/create-react-class and replacing with a call to js/createReactClass.

@bhauman
Copy link

bhauman commented Aug 17, 2017

I would advise working on a solution that extends React.Component so that the solution is backwards compatible. And perhaps more future proof.

@wilkerlucio
Copy link
Contributor

wilkerlucio commented Aug 17, 2017

@bhauman the PR that I sent uses the official react fallback for it; I guess this is the safest we can get.

@bhauman
Copy link

bhauman commented Aug 17, 2017

@wilkerlucio its a valid solution

It has its limitations though. It depends on another package, which will be probably be deprecated itself much sooner than we want.

It limits users to fairly recent React versions whereas the ability to extend React.Component has been around since React 14.

I guess I'm just saying that it's probably time we get onboard the train.

@wilkerlucio
Copy link
Contributor

wilkerlucio commented Aug 17, 2017

@bhauman not sure what you mean, according to React docs: https://facebook.github.io/react/docs/react-without-es6.html using the create-react-class package is the official way for people that don't want to go with ES6, as far as I understand this is not supposed to get deprecated any time soon.

@wilkerlucio
Copy link
Contributor

wilkerlucio commented Aug 17, 2017

@bhauman I mean, using the class syntax would mean having to support it on CLJS somehow, or rely on some ugly hacks with js*, do you think this is safer than using the create-react-class package? Or do you have something different in mind?

@bhauman
Copy link

bhauman commented Aug 17, 2017

This is indeed possible. You won't have to change any deps whatsoever if we extend React.Component.

@bhauman
Copy link

bhauman commented Aug 17, 2017

I've just worked this out in Devcards I can get you some example code.

@wilkerlucio
Copy link
Contributor

wilkerlucio commented Aug 17, 2017

I would like to see that, but being honest, I prefer using the official implementation for it, there are plenty of caveats in the create-react-class implementation, creating a custom thing instead of just using the official one has a much higher chance of missing some feature of that IMO.

@bhauman
Copy link

bhauman commented Aug 17, 2017

I hear you, it is a bigger lift in this case to verify that everything is working correctly.

@bhauman
Copy link

bhauman commented Aug 17, 2017

Yeah after looking at it, it is a bit more invasive to make these changes to Om.

@wilkerlucio
Copy link
Contributor

wilkerlucio commented Aug 17, 2017

Thanks for the links, I'm glad you could make it work with so little. As you said, the change is not so simple in om codebase. Unless Facebook says something about the create-react-class package getting deprecated it should be safe for the foreseeable future.

@nbardy
Copy link

nbardy commented Nov 6, 2017

Any updates on this now that React 16.0 is out. From the looks of it this is all that is required to make om 16.0 compatible.

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

5 participants