This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-18
Channels
- # beginners (15)
- # boot (23)
- # cider (8)
- # clara (29)
- # cljs-dev (86)
- # cljsrn (36)
- # clojars (9)
- # clojure (211)
- # clojure-dusseldorf (5)
- # clojure-italy (21)
- # clojure-sg (2)
- # clojure-spec (4)
- # clojure-uk (12)
- # clojurescript (204)
- # cursive (5)
- # data-science (12)
- # datomic (15)
- # dirac (99)
- # emacs (1)
- # events (2)
- # figwheel (1)
- # fulcro (9)
- # graphql (27)
- # hoplon (50)
- # instaparse (9)
- # juxt (61)
- # keechma (6)
- # leiningen (1)
- # luminus (4)
- # lumo (24)
- # off-topic (24)
- # om (16)
- # onyx (17)
- # parinfer (35)
- # pedestal (3)
- # planck (12)
- # protorepl (8)
- # re-frame (15)
- # reagent (22)
- # ring (1)
- # rum (1)
- # spacemacs (3)
- # uncomplicate (4)
- # vim (5)
- # yada (1)
No soda-ash channel so I'm asking here. How do I use the :as
prop to render a semantic ui component as a different semantic ui component?
For example [soda-ash.core/Label {:as soda-ash.core/Button}]
So this doesn't work because it's a function and not a react component
@urbank I have only ever used :as
to define the tag. Say setting it to "div" or "a" or "li" etc.
Is it possible to write a higher level component that will walk all of a component’s descendants to do something like say disable input elements?
I think it’s more common to have the parent set up an atom that the children will read, and then enable/disable themselves depending on the state of the atom.
Also makes it easier to have an on-click handler that swap!
s the atom to a new state, so you can have a child component (eg. a button) that easily updates its siblings.
@jfntn walking the (direct) children is definitely a common pattern in react, though I haven't done it in reagent yet
could you describe your use case a bit more?
@pesterhazy I have a large form where some of the fields need to be disabled depending on a complex workflow, I know this could be achieved a number of ways but that would be the most generic solution
the reagent way I think would be to use a global state atom for that, or a local one
I think I agree with @manutter51
but the "look at r/children" approach would be interesting as well
If you can make it work, i'd be curious to see what you come up with
I reverted to the stateful approach for now, but that’s not very reusable unfortunately so I might try to figure it out
I think it’s non-trivial because it probably requires hook into the reagent render function somehow
@jfntn my inclination would be to put the conditionals that need to be calculated into the parent, and have it pass the booleans to the children via the state map