Ref
A ref object that is also a ref callback: pass it as ref={r} (the renderer calls it with the element) and read the element as r.current.
A ref object that is also a ref callback: pass it as ref={r} (the renderer calls it with the
element) and read the element as r.current. undefined when nothing is attached.
Import#
ts
import type { Ref } from "@shadow-js/core";
Signature#
ts
interface Ref<T> {
/** Stores `value` as `current`; `undefined` clears it. The renderer calls it with the element. */
(value: T | undefined): void;
/** The value last passed to the ref, or `undefined` when nothing is attached. Not reactive. */
readonly current: T | undefined;
}
Members#
| Name | Type | Description |
|---|---|---|
T |
T |
|
current |
readonly current: T | undefined |
The value last passed to the ref, or undefined when nothing is attached. Not reactive. |