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
.
- Using callback refs in your code base?
- Any use case of calling
ReactDOM.props(~id: "foo", ~ariaDetails: "detail", ..., ())
directly?