ReasonReact non-standard HTML tag attributes?

Ok, I’ve been playing with an odd mix of React & Unpoly but one challenge in doing so is not being able to annotate the <a tags with the proper HTML attributes. For instance:

<a href="/users" up-dash=".main">User list</a>

The upDash in React results in a type error because it’s non-standard HTML which is desirable in most situations, however, I would like to do it anyway :upside_down_face:. This also applies to data attributes that are valid HTML.

Thanks in advance!

Hi

React.cloneElement could be helpful.

2 Likes

Hi! I have used this pattern, taken from the listboxkit project. It’s called the as decorator.

type optionProps = {
  @as("aria-selected")
  ariaSelected: bool,
  role: string,
  onClick: ReactEvent.Mouse.t => unit,
}

But how could we pass this to the div tag?

Sorry you are correct about that, I was referring only to type definition!