API reference / @evolu/react-native / web / useOwner
Variable: useOwner()
const useOwner: (owner) => void;
Defined in: react/dist/useOwner.d.ts:21
React Hook for managing sync owner subscriptions.
When the component mounts, it registers the owner for syncing. When the component unmounts or the owner changes, it automatically unregisters.
Example
import { useOwner } from "@evolu/react";
function MyComponent({ shardOwner }: { shardOwner: SyncOwner | null }) {
useOwner(shardOwner);
// Component will sync with shardOwner while mounted
return <div>Syncing with shard...</div>;
}
Parameters
| Parameter | Type |
|---|---|
owner | | SyncOwner | null |
Returns
void