@serenity-is/domwise / createRef
Function: createRef()
createRef<
T>():RefObject<T>
Defined in: src/ref.ts:18
Creates a new sealed RefObject whose current is initially null.
The returned object is Object.sealed so that no new properties can be
added, matching the React.createRef contract.
Type Parameters
T
T = any
Type of the value held by the ref.
Returns
RefObject<T>
A sealed RefObject<T> with current set to null.
Example
const inputRef = createRef<HTMLInputElement>();
return <input ref={inputRef} />;
// later: inputRef.current?.focus();