[RFC] ReactDOM props type

There are two types of props in ReactDOM of rescript-react. One is type props and the other is type domProps. The only difference between them is the ref.

type domProps = { ... , ref: domRef, ... }

type props = { ... , ref: Js.nullable<Dom.element> => unit, ... }

I think the second ref is for the callback refs:

// js
<input ref={ref => this.inputElement = ref} />

As the React doc says, it is recommended in earlier release version of React 16.3.

Note: The examples below have been updated to use the React.createRef() API introduced in React 16.3. If you are using an earlier release of React, we recommend using callback refs instead.

I’d like to have your comment about merging two types of props into one which is the domProps.

  1. Using callback refs in your code base?
  2. Any use case of calling ReactDOM.props(~id: "foo", ~ariaDetails: "detail", ..., ()) directly?
1 Like

Side comment: How do you guys post in the Development category? Do I need some permission or badge for it?

It’s now in the dev category.

1 Like

Thank you always @zth!