bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

Warning: React.createClass is deprecated #126

Closed borkdude closed 5 years ago

borkdude commented 6 years ago

I'm using these deps:

[reagent "0.7.0"]
    [cljsjs/react-with-addons "15.5.4-1"]
    [cljsjs/react-dom-server "15.5.4-1"]
    [cljsjs/react-dom "15.5.4-1"]
    [cljsjs/create-react-class "15.5.3-0"]

along with devcards 0.2.3 and I'm getting this warning:

react-with-addons.inc.js:4946 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.

  printWarning @ react-with-addons.inc.js:4946
  warning @ react-with-addons.inc.js:4970
  createClass @ react-with-addons.inc.js:1562
  (anonymous) @ system.cljs:321

Is there any chance this can be fixed?

bhauman commented 6 years ago

So this is a problem, but this particular example is incorrect b/c the source is react-with-addons and that is not caused by devcards.

But sablono calls React.createClass and so does cljs-react-reload.

Sablono has an unreleased fix for this and I'm going to work on cljs-react-reload.

borkdude commented 6 years ago

@bhauman I noticed and I made a patched version for our own use (https://github.com/borkdude/cljs-react-reload/commit/4b8d5984a0b7f0ae807b292d93aad6534d4a79bd). I'm not sure what the proper solution would be to support React <= 15 and >= 16. I guess the version of React can be checked.

bhauman commented 6 years ago

Can you send a PR with that change?

On Tue, Aug 15, 2017 at 5:37 PM, Michiel Borkent notifications@github.com wrote:

@bhauman https://github.com/bhauman I noticed and I made a patched version for our own use (borkdude/cljs-react-reload@4b8d598 https://github.com/borkdude/cljs-react-reload/commit/4b8d5984a0b7f0ae807b292d93aad6534d4a79bd ). I'm not sure what the proper solution would be to support React <= 15 and

= 16. I guess the version of React can be checked.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bhauman/devcards/issues/126#issuecomment-322597113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQKq69b7PI43t5kJZ06DvLfz_0bq0ks5sYg-ugaJpZM4OvrFI .

bhauman commented 6 years ago

I actually just did it, if you don't mind :)

On Tue, Aug 15, 2017 at 5:39 PM, Bruce Hauman bhauman@gmail.com wrote:

Can you send a PR with that change?

On Tue, Aug 15, 2017 at 5:37 PM, Michiel Borkent <notifications@github.com

wrote:

@bhauman https://github.com/bhauman I noticed and I made a patched version for our own use (borkdude/cljs-react-reload@4b8d598 https://github.com/borkdude/cljs-react-reload/commit/4b8d5984a0b7f0ae807b292d93aad6534d4a79bd ). I'm not sure what the proper solution would be to support React <= 15 and

= 16. I guess the version of React can be checked.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bhauman/devcards/issues/126#issuecomment-322597113, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQKq69b7PI43t5kJZ06DvLfz_0bq0ks5sYg-ugaJpZM4OvrFI .

borkdude commented 6 years ago

@bhauman I don't think it's a good idea to merge that change, since it will break for older versions of React and will only work with create-react-class. I looked at sablono and this is probably the way to make it stable for all versions: https://github.com/r0man/sablono/pull/167/files

bhauman commented 6 years ago

Let me look at what a solution like this would take.

On Tue, Aug 15, 2017 at 5:44 PM, Michiel Borkent notifications@github.com wrote:

@bhauman https://github.com/bhauman I don't think it's a good idea to merge that change, since it will break for previous versions of React. I looked at sablono and this is probably the way to make it stable for all versions: https://github.com/r0man/sablono/pull/167/files

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bhauman/devcards/issues/126#issuecomment-322598445, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQL_N7M3gGQ72ru6pUDe8yGJ_3gN5ks5sYhEsgaJpZM4OvrFI .

mattly commented 6 years ago

As of React 16.3, React.createClass is not a function

bhauman commented 5 years ago

these issues have been fixed