This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-18
Channels
- # announcements (10)
- # babashka (21)
- # beginners (99)
- # biff (66)
- # catalyst (3)
- # cherry (1)
- # cider (11)
- # clojure (38)
- # clojure-austin (3)
- # clojure-dev (23)
- # clojure-europe (21)
- # clojure-hungary (10)
- # clojure-nl (2)
- # clojure-norway (57)
- # clojure-uk (2)
- # clojurescript (9)
- # cursive (6)
- # fulcro (5)
- # hyperfiddle (14)
- # integrant (4)
- # introduce-yourself (3)
- # lsp (24)
- # off-topic (14)
- # reagent (12)
- # reitit (13)
- # releases (8)
- # sci (16)
- # shadow-cljs (8)
- # solo-full-stack (1)
- # spacemacs (5)
- # squint (3)
- # xtdb (14)
Hi all, does reagent
filters out invalid CSS values or keys?
For example, I have given a component the following CSS attribute but it didn't render to the screen:
:app-test :value-2
I taught its a map like :style {:key "value"
Yeah, I was assuming the OP meant something like [:div {:style {:app-test :value-2}}]
.
I think :value-2
is either a function that returns a string
or a string
instead of a key
:value-2
is a regular keyword, which Reagent will turn into a string. I use things like {:background-color :red}
all the time.
Oh. OK. Maybe he's not using a reagent recognised keyword then
As I said at the start - Reagent does not check the keyword. It just converts it and passes forward. So it's either React removing the value altogether, or the browser not displaying it because it's invalid.
Also, just as an advice: Reagent's source code is less than 2k loc - anyone can read it all in an evening. Not saying, of course, that an evening would be nearly enough to understand it all, especially given its long history and compatibility with different versions of React, but even just reading it will give a much better understanding of many things.