This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-03
Channels
- # aleph (3)
- # announcements (1)
- # beginners (116)
- # boot (8)
- # braveandtrue (4)
- # cider (40)
- # cljdoc (120)
- # cljsrn (10)
- # clojure (29)
- # clojure-austin (4)
- # clojure-dev (43)
- # clojure-germany (1)
- # clojure-italy (4)
- # clojure-nl (17)
- # clojure-russia (19)
- # clojure-uk (76)
- # clojurescript (118)
- # cursive (13)
- # datascript (11)
- # datomic (73)
- # emacs (24)
- # figwheel-main (176)
- # fulcro (40)
- # hyperfiddle (4)
- # leiningen (3)
- # off-topic (1)
- # pedestal (4)
- # re-frame (6)
- # reagent (22)
- # reitit (1)
- # ring (3)
- # rum (8)
- # shadow-cljs (41)
- # spacemacs (11)
- # specter (19)
- # unrepl (1)
Hi, I'm going through the development guide and my js console is giving me a
app.intro.js:6 Uncaught ReferenceError: devcards is not defined
at app.intro.js:6
(anonymous) @ app.intro.js:6
@pauld looks like the fulcro.client.cards
may emit devcards
related code but doesn't require devcards. try to add a devcards.core
require before the fulcro.client.cards
require
Ah, thanks! Seems so obvious now that you mention it - works now that I added that require to my intro.cljs file.
@tony.kay does fulcro 2.6 support DCE for colocated css? :3
is there any support in a defsc
for doing stuff in the actual react constructor? ie. I want to construct a function for use as a :ref
(solved without a constructor, also the answer is no there is no way to hook into the constructor)
@U05224H0W actually :initLocalState
is equivalent to a constructor, other than what it returns becomes the component’s local state.
Yep…https://github.com/fulcrologic/fulcro/blob/develop/src/main/fulcro/client/primitives.cljc#L520
initLocalState
will be called as part of the constructor..the fact that it’s return value has meaning is simple enough: return an empty map if you don’t need CL state
I have considered adding a formal :constructor
option to defsc…but other than the documentation value I had considered it overkill because this works already…but I should document that 🙂
yeah. initLocalState
is a bit misleading in the name so I dismissed that when looking through the code.
I opted for a little helper (term-container {:ref (util/ref-fn this ::term attach-terminal)})
Yeah. The other thing is a constructor in js land is supposed to call the “super”…and I didn’t want to lead ppl down that path. So I think I’ll stick with it this way and just add docs.
It’s a borderline case to me: you can get exactly what you want from :initLocalState
, so other than the slight misnomer, it doesn’t merit more API.
If you strongly feel a :constructor
option is merited, I’m game to add one. I’ve been on the fence about it. I’ve been in the “slim it down” phase for a while 🙂
(not that there is anything I can really remove without breakage…but you get the sentiment I’m sure)
should be ok the way it is. I just didn't think to use it this way since I knew I didn't want actual "state"