Skip to main content

providePowerSync()

function providePowerSync(database, key): void

Provide the PowerSync client for all the caller component's descendants. This function works on a hierarchical basis, meaning that the client provided by providePowerSync in a child component will override the client provided by createPowerSyncPlugin in a parent component. If createPowerSyncPlugin was used to provide an app-wide client, all providePowerSync invocations are below it in the hierarchy.

If the key parameter is provided, the client will be provided under that key instead of the default PowerSync key.

Parameters

ParameterTypeDefault value
databaseMaybeRef<AbstractPowerSyncDatabase>undefined
keystringundefined

Returns

void