MutableRef

@JSType
trait MutableRef[T] extends Object

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.

class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

Extension method from react

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.

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from
Object
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def toLocaleString(): String
Inherited from
Object
def valueOf(): Any
Inherited from
Object

Abstract fields

@ExposedJSMember
var current: T