This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-08
Channels
- # architecture (8)
- # boot (18)
- # cider (33)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (77)
- # clojure-dev (6)
- # clojure-dusseldorf (1)
- # clojure-russia (1)
- # clojure-spec (4)
- # clojurescript (40)
- # cryogen (1)
- # cursive (4)
- # dirac (2)
- # emacs (1)
- # figwheel (10)
- # funcool (2)
- # hoplon (21)
- # incanter (2)
- # leiningen (1)
- # lumo (44)
- # off-topic (2)
- # onyx (53)
- # overtone (5)
- # pedestal (8)
- # re-frame (9)
- # reagent (37)
- # rum (9)
- # spacemacs (16)
- # sql (2)
- # testing (1)
- # unrepl (4)
- # untangled (4)
- # yada (16)
Looks like using React with module processing will get even more desirable in future, as createClass
is being deprecated (and needs additional lib) and React-with-addons is discontinued, and addons need to be provided as separate libs: https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html#migrating-from-react.createclass
My understanding is that all React wrappers for Cljs currently use createClass
and Cljs can't emit JS classes?
@juhoteperi Can't emit the js "class" syntax directly, but that is just sugar for normal constructor + prototype pattern, which cljs can certainly do.
(.setStripTypePrefixes compiler-options #{"cljs.core.prn"})
.. strips every (prn ...)
call when optimizing
@juhoteperi Om Next doesn't use create Class, see https://github.com/omcljs/om/blob/master/src/main/om/next.cljc#L387
It employs the strategy @favila described
@anmonteiro I don't think that is what he meant
hmm, but I think it will solve the problem
He said all React wrappers use createClass
I'm giving an alternative
Reagent will just need some handling for reagent/create-class
where all the lifecycle methods are described using a map
@juhoteperi doesn't seem hard to do either
Yeah something like reduce which extends the object for each kv or something
One cool thing to note there is extends React.Component
just boils down to copy the prototype
@thheller that is really cool, does it just strip every call that starts with the prefix?
Which also means you can shoot yourself in the foot if not careful :-)
Oh. Wow.
@anmonteiro Btw. does Om have some logic to require React from Cljsjs or npm-deps? I guess not as it refers js/React
.... or does it work correctly with either when externs are provided
... I think I'm not being able to describe what I'm thinking 😄
@juhoteperi React is required from CLJSJS
What if user excludes cljsjs/react and uses npm-deps instead?
Then the user needs to (set! js/React)
And probably also (set! js/ReactDOM)
?
Npm deps is so new that we haven't gotten around to make it work