A minimalistic ClojureScript interface to React.js
p-himik 2020-05-11T03:11:42.424400Z

The question was about ratom vs ratom. :) There's an alias in Reagent.


Uggh. Sorry

Eliraz 2020-05-11T11:34:14.425100Z

anyone tried the new `functional-compiler` of reagent? how would I know that Reagent actually creating function components and not Class components? I mean how can I see the React code that comes out ?

Eliraz 2020-05-11T11:39:01.426100Z

Also, using the new functional-compiler how would you use third party libraries? it's all the same as it was?


I'm trying to use react-testing-library with shadow-cljs and am wondering if I should target the :browser-test or :node-test for it. I mean in the React world, jest is obviously not targeting the browser ...


Well, when I try to run it in a browser context, a basic test I ran apparently gets confused with the generated result page, so I was mostly thinking about using it with jsdom. I'll give karma a shot first, though and see if that just works.


Thanks everybody for the input.


And of course it turns out that not react-testing-library was confused but my test and it works as a browser-test just fine.

v 2020-05-11T13:33:54.428800Z

It should be :karma . Here is a build config that I recently used to solve the same problem.

          {:target    :karma
           :output-to "out/karma/test.js"
           :output-dir "out/karma"
           :source-path "karma"
           :compiler-options {:infer-externs :auto}
           :ns-regexp "-test$"}}}

v 2020-05-11T13:35:17.429100Z

Please go through this -


Hmm. I'm under the impression that using Karma actually also involves launching a browser to run the tests. If possible, I would like to avoid this.

v 2020-05-11T14:14:36.429500Z

Nope, you can run in headless mode

thheller 2020-05-11T14:33:03.429700Z

I'm not sure how react-testing-library works but if its meant to run in node then :node-test should be fine

lilactown 2020-05-11T16:10:14.429900Z

react-testing-library does expect to use the DOM; so you’ll want to run it either in a browser context (using :browser-test for local dev and :karma for CI) or in :node-test and provide a DOM polyfill like jsdom:

Mark Wardle 2020-05-11T21:30:12.432Z

I'm sorry if this is such a newbie question, but if I wanted to reagent-ify a google closure component such as DatePicker, how would I do so? I've tried copying the technique in but I get an error react_devtools_backend.js:6 error when calling lifecycle function pc-ward.core/mount-root TypeError: this.getBaseCssClass is not a function at goog.ui.DatePicker (datepicker.js:105) I probably need to learn react and javascript before trying to convert JS examples into cljs! All tips appreciated thank you.

lilactown 2020-05-11T21:58:39.433200Z

@mark354 a google closure component has nothing to do with react, so you’re going to struggle a lot trying to use anything in that document with

Mark Wardle 2020-05-12T10:06:45.434100Z

Ah I see. Thank you. I assumed the reagent macro did all of the js getElementById and render for an arbitrary component. So essentially I have to create a reagent “form 3” type and run getElementById and render from there into the DOM fragment? Thanks I’ll give this a try.