Skip to content

Function: useReActiveModel() ​

ts
function useReActiveModel<T>(
  modelName: Extract<T, string>,
): ReactiveModelConstructor<
  any,
  any,
  string,
  Record<string, RelationshipConfiguration>,
  Required<{} | undefined>
>;

Injects and returns a specific model constructor from the Vue ReActiveRecord database.

Type Parameters ​

Type ParameterDescription
T extends string | number | symbolThe key of the model in your VueReActiveRecordTypes.ObjectMap.

Parameters ​

ParameterTypeDescription
modelNameExtract<T, string>The name of the model to retrieve from the database.

Returns ​

ReactiveModelConstructor<any, any, string, Record<string, RelationshipConfiguration>, Required< | { } | undefined>>

The injected model constructor corresponding to the given model name.

Throws ​

If the database constructor is not found in the current Vue context, or if the specified model is not defined in your configuration.