Skip to Content

@revideo/core


@revideo/core / utils / createRefMap

Function: createRefMap()

createRefMap<T>(): ReferenceMap<T>

Defined in: utils/createRefMap.ts:53 

Create a group of references.

Type Parameters

T

T

Returns

ReferenceMap<T>

Remarks

The returned object lets you easily create multiple references to the same type without initializing them individually.

You can retrieve references by accessing the object’s properties. If the reference for a given property does not exist, it will be created automatically.

Example

const labels = createRefMap<Txt>(); view.add( <> <Txt ref={labels.a}>A</Txt> <Txt ref={labels.b}>B</Txt> <Txt ref={labels.c}>C</Txt> </>, ); // accessing the references individually: yield* labels.a().text('A changes', 0.3); yield* labels.b().text('B changes', 0.3); yield* labels.c().text('C changes', 0.3); // checking if the given reference exists: if ('d' in labels) { yield* labels.d().text('D changes', 0.3); } // accessing all references at once: yield* all(...labels.mapRefs(label => label.fill('white', 0.3)));
© 2026 Haven Technologies, Inc.
Function: createRefMap() – Revideo