API reference › @evolu/vue › createUseEvolu

function createUseEvolu<
  S extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  >,
>(_evolu: AppOwnerEvolu<S>): () => AppOwnerEvolu<S>;

Defined in: createUseEvolu.ts:43

Creates a helper function returning a type-aware instance of Evolu, without disposal, because the component doesn't own it. It's for an app that creates its instance with createEvolu; an app that EvoluAppProvider provides uses createEvoluBinding.

Example

Its replacement, useEvolu of createEvoluBinding, returns the same instance.

import {
  assertType,
  type AppOwnerEvolu,
  type TestEvoluSchema,
} from "@evolu/common";
import { createEvoluBinding } from "@evolu/vue";

// Instead of createUseEvolu(evolu). Call useEvolu in component setup.
const { useEvolu } = createEvoluBinding<TestEvoluSchema>();

assertType<ReturnType<typeof useEvolu>, AppOwnerEvolu<TestEvoluSchema>>();

Deprecated

Use createEvoluBinding<S>().useEvolu of createEvoluBinding, which returns the same instance, also for an app that creates it with createEvolu.