How to use React "useId" Hook in rescript?

Hi All,
I am trying to generate unique id’s for each input field. Can anyone suggest how to use React useId Hook in rescript.

Thanks in Advance!!

There is nothing special about it, you can do it the same way as in JavaScript.

e.g.:

module PasswordField = {
  @react.component
  let make = () => {
    let passwordHintId = React.useId()

    <>
      <label>
        {React.string("Password:")}
        <input type_="password" ariaDescribedby={passwordHintId} />
      </label>
      <p id={passwordHintId}>
        {React.string("The password should contain at least 18 characters")}
      </p>
    </>
  }
}

[Playground link]