Overview
Combines block-status fetching and toggle actions into a single hook. On mount, loads whether the current user blocksuserId, then provides a toggleBlock function to block or unblock in one call. This is the hook to wire to a block/unblock button.
Blocking is part of the trust & safety (moderation) bundle. See Moderation — Blocking for what a block prevents and hides.
Usage Example
Parameters
string
required
The ID of the target user.
Returns
boolean | null
true if the current user blocks the target, false if not, null while the initial status is loading.boolean
true while the initial status check is in progress.() => Promise<void>
Blocks the target user if not currently blocked; unblocks if currently blocked. No-ops while loading or if
userId is the current user’s own ID.
