Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Confusion about React.useImperativeHandle() first parameter type

$
0
0

I would have expected the first parameter of React.useImperativeHandle() (i.e., the reference) to be of type React.ref<Js.Nullable.t<'value>>. This way, the value can be set by React.useImperativeHandle() for its caller.

However, the type is actually Js.Nullable.t<React.ref<'value>> – they are swapped.

If it is null (e.g., initial state), how is React.useImperativeHandle() supposed to set the current member of the reference for the caller?

Thanks in advance


Viewing all articles
Browse latest Browse all 2592

Trending Articles