Experimental
const { called, data, error, loading, execute } = useLazyPublication();
This hook is experimental and may change in the future.
const { called, data, error, loading, execute } = useLazyPublication();
const callback = async () => {
const result = await execute({ forId: publicationId });
if (result.isFailure()) {
toast.error(result.error.message);
return;
}
const publication = result.value;
// do something with the publication
}
useLazyPublication
is a lazy version of usePublication React Hook.This hook will not fetch the publication until the returned function is called.
This hook is intended to enable more complex use cases, the vast majority of use cases should use usePublication instead.