Blocks an async flow and unblocks it from an external context.
The type of value that can be passed to unblock to resolve the Promise returned by block.
unblock
Promise
block
const [isBlocked, block, unblock] = useBlocker<string>();useEffect(() => { // Returns a Promise that resolves with the value passed to unblock(value) block(); // → Promise<string> // Unblocks the blocker with the given value unblock('Hello');}, []); Copy
const [isBlocked, block, unblock] = useBlocker<string>();useEffect(() => { // Returns a Promise that resolves with the value passed to unblock(value) block(); // → Promise<string> // Unblocks the blocker with the given value unblock('Hello');}, []);
Blocks an async flow and unblocks it from an external context.