Browse documentation

v-ref

Concept. Provides the rendered DOM node and cleans the ref on removal.

Table of contents

Category

Concept

Public signature

ts
JSX directive: <element v-ref={callbackRef | { current: DomElement | null }} />

Runtime behavior

v-ref assigns the rendered DOM node to an object ref or passes it to a callback ref. Valyrian clears object refs to null and calls callback refs with null when the node is removed, the ref changes or disappears, or the tree unmounts. A callback ref can return its own cleanup function.