bhauman / devcards

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

ReactDOM.render is not defined #93

Closed bago2k4 closed 8 years ago

bago2k4 commented 8 years ago

Hi, I have been using devcards for human tests in this project for a while and i have to say that i'm very happy with it. The problem is that since version 0.2.1 it fails with this error:

Uncaught TypeError: Cannot read property 'render' of undefined
   devcards$system$renderer @ system.cljs?rel=1453127706018:334
   (anonymous function) @ system.cljs?rel=1453127706018:467

The error happens at this line https://github.com/bhauman/devcards/blob/master/src/devcards/system.cljs#L334

If I check the js console i can see that ReactDOM is suggested by the auto completion but if I try to print out the value in the console it's undefined and ReactDOM.render is too.

Any suggestion of what may be causing this issue? How can i force ReactDOM to be included in the compiled js?

Thanks for this great tool!

belucid commented 8 years ago

FWIW, it works fine up to version: 0.2.0-8

Lein file is here: https://github.com/open-company/open-company-web/blob/mainline/project.clj

bhauman commented 8 years ago

It's really hard to know exactly what is happening here. But perhaps an explicit :dependency on react and react-dom is in order?

bago2k4 commented 8 years ago

@bhauman i have added all the dependencies: https://github.com/open-company/open-company-web/blob/devcards-fix/project.clj#L54-L57

also i have forced the require of those deps to make sure they are included but no luck: https://github.com/open-company/open-company-web/blob/devcards-fix/src/open_company_web/lib/devcards.cljs#L12-L15

I also tried to move these dependencies to the main :dependencies object instead of the :devcards profile but the result is the same.

Any other idea/suggestion?

bhauman commented 8 years ago

Well I downloaded your project and it seems that you need to change this line [cljs-react-test "0.1.3-SNAPSHOT" :exclusions [cljsjs/react]] ; React test utilities to this [cljs-react-test "0.1.3-SNAPSHOT" :exclusions [cljsjs/react-with-addons]] ; React test utilities

lein deps tree showed me where react 13 was getting pulled in.

bago2k4 commented 8 years ago

@bhauman thanks, that worked! I'll update the my project with your suggestion.

danielcompton commented 8 years ago

I ran into this issue setting up devcards on a project that was using Reagent 0.5.1. It might be worth making a note in the README that the latest version of Devcards requires React 14, which conflicts with Reagent versions lower than 0.6.0-alpha?

It could also be worth mentioning that Devcards bundles Sablono as another dep, that wasn't obvious from the README. I know I can read project.clj for dependencies, but it was unexpected that Sablono as a UI library would be bundled with devcards. Not a big deal, just explaining my thought processes.