Fork me on GitHub
#reagent
<
2022-02-04
>
jlfischer22:02:55

Hi, does anyone know if there's a way to use custom / non-standard DOM attributes using Reagent? In my case, I was hoping to attach some styling using a CSS attribute selector, but the only custom attributes that Reagent seems to let through are data-* ones. React's supposed to support them as of version 16: https://reactjs.org/blog/2017/09/08/dom-attributes-in-react-16.html What I'm trying is something like this: [:div {:class "my-class" :my-attr true} ... ] And hoping to get this rendered bit of DOM: <div class="my-class" my-attr=true>..</div> So I can do this in CSS:

div.my-class[my-attr] {
  /* insert style here */
}
It works if I use :data-my-attr as the attribute name, but otherwise unrecognized attributes are being ignored.