@evolu/react
Version:
Evolu for React
17 lines (16 loc) • 473 B
JavaScript
import { useEffect } from "react";
import { useEvolu } from "./useEvolu.js";
/**
* React Hook for Evolu `useOwner` method.
*
* Using an owner means syncing it with its transports, or the transports
* defined in Evolu config if the owner has no transports defined.
*/
export const useOwner = (owner) => {
const evolu = useEvolu();
useEffect(() => {
if (owner == null)
return;
return evolu.useOwner(owner);
}, [evolu, owner]);
};