MutableRef
For use with useRef() hook which is slightly different than the mutable
Ref. current
is designed to be set directly or can be used on the ref
attribute for a component. Since you can provide an initial value, if you
want null
to be valid, either use null
directly or model it explicitly
as T|Null
to force client's to deal with the explict null value (otherwise
they need to check for the null
value directly).
Reconcile with ReactRef perhaps rename the member to something like unsafe
.
- Type Params
- T
Ref type. Could be
T|Null
as well.
Value members
Concrete methods
If needed to satisfy API such as the ref associated with DOM elements, convert to a ReactRef. This is messy in typescript as well.
If needed to satisfy API such as the ref associated with DOM elements, convert to a ReactRef. This is messy in typescript as well.