Skip to main content

Function: createRef()

createRef<T>(value): Ref<T>

Defined in: packages/native/dist/index.d.ts:21

Creates a mutable reference wrapper.

Used for out-parameters in FFI calls where the native function needs to write a value back.

Type Parameters

Type ParameterDescription
TThe type of the referenced value

Parameters

ParameterTypeDescription
valueTInitial value

Returns

Ref<T>

A reference object containing the value

Example

const errorRef = createRef<GError | null>(null);
const result = someFunction(errorRef);
if (errorRef.value) {
console.error(errorRef.value.message);
}