How to pass a reserved keyword as a prop in reason-react


I am trying to use rimble-ui ui-library, and one of the props that a button takes is called “as”. This is unfortunately a reserved word in reason. So I don’t know how to use this component in my reason-react app.

Here are the docs for the library.

This is my code:

[@bs.module "rimble-ui"] [@react.component]
external make:
  (~as_: string, ~href: string, ~target: string, ~children: React.element) =>
  React.element =

I’d like a way to replace the _as with ‘as’ as a prop name.

#2 <- posted on SO, I think it is good to get more reason questions on there.

The answer has been posted on SO :slight_smile:


It’s good you posted it on SO, we do need more visibility there.
About the answer itself, I’ve always found weird bucklescript uses a prefix underscore for that when it’s already used for unused variables, a postfix underscore would have been less confusing in my opinion.