Fork me on GitHub
#reagent
<
2016-02-10
>
sonnyto13:02:14

how do I add arbitrary attributes to a tag? for example [:table {:foo "bar"}] does not seem to translate to <table foo="bar">

grav14:02:51

@sonnyto: I’d think React cleans them up

grav14:02:11

"If you pass properties to native HTML elements that do not exist in the HTML specification, React will not render them. If you want to use a custom attribute, you should prefix it with data-."

grav14:02:53

what’s the main idea of using reactions?

grav14:02:06

currently, we just derive data in the component ...

martinklepsch15:02:53

@grav: if you derive in components they're recomputed each render I believe

grav18:02:12

@martinklepsch: Ok, so it’s an optimization. I wonder if it’s worth the complexity

mangr3n19:02:43

It is an optimization but I thought it also was a way of explicitly defining a signal graph. It seems to me to be a decomplecting thing, not a complecting thing. I don’t use the database and reactions for static data, but I absolutely use it if I’m changing my render for any reason, the parts that can mutate go in the database, and I use reactions to describe signals that resolve to values and drive the react render.

timothypratley22:02:06

@sonnyto if you have to have an unsupported attribute, you can [span {:dangerouslySetInnerHTML {:__html "<scary foo=1></scary>"}}], but best to avoid them if possible simple_smile

sonnyto22:02:03

@timothypratley: lol data-* attribute is supported so I used that

timothypratley22:02:25

ooOOOOooo nice!!! simple_smile