Open rinama opened 7 years ago
I would advise working on a solution that extends React.Component
so that the solution is backwards compatible. And perhaps more future proof.
@bhauman the PR that I sent uses the official react fallback for it; I guess this is the safest we can get.
@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.
@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.
@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?
This is indeed possible. You won't have to change any deps whatsoever if we extend React.Component
.
I've just worked this out in Devcards I can get you some example code.
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.
I hear you, it is a bigger lift in this case to verify that everything is working correctly.
Yeah after looking at it, it is a bit more invasive to make these changes to Om.
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.
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.
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.