devcards

Devcards aims to provide a visual REPL experience for ClojureScript https://github.com/bhauman/devcards
currentoor 2016-04-12T18:29:58.000148Z

With cljsjs/fixed-data-table in devcards it works fine. But in my main app the fixed-data-table code throws an error because ReactDOM is undefined, even though ReactDOM is available as a global var in the js console.

currentoor 2016-04-12T18:30:33.000149Z

Does devcards do anything special to make sure ReactDOM is defined in cljsjs packages?

currentoor 2016-04-12T18:33:42.000150Z

The only thing I saw in the source was this. https://github.com/bhauman/devcards/blob/c463b5d9e675063e8288b20ceff253ad0289d3f2/src%2Fdevcards%2Fsystem.cljs#L12 I copied that but it didn't work.

bhauman 2016-04-12T18:38:08.000152Z

@currentoor: You probably are not requiring ReactDOM before its first use.

bhauman 2016-04-12T18:39:05.000153Z

You have to require cljsjs.react and cljsjs.reactdom.

currentoor 2016-04-12T18:39:50.000154Z

@bhauman: I'll try adding those two the to top of my :require statements.

bhauman 2016-04-12T18:41:27.000155Z

If you have to level code that is executing on file load you need to make sure that the require happens before that code executes

bhauman 2016-04-12T18:41:43.000156Z

"Top level"

bhauman 2016-04-12T18:44:17.000158Z

I would go to your root file and require it there. And then look at the Dom and see what order things are loading

currentoor 2016-04-12T18:46:08.000159Z

Good idea, I'll try that. Thanks!

currentoor 2016-04-12T19:41:51.000160Z

@bhauman: it works now, Thank you very much!