useBlockManager is a convenience hook for building block/unblock buttons on a user profile. It automatically loads the current block status on mount and exposes a toggleBlock function that handles both blocking and unblocking.
Blocking is a trust & safety primitive shipped as part of the moderation bundle — the same package that provides reporting and suspensions. See Moderation — Blocking for the full enforcement behavior.
Requires the
moderation bundle. Blocking is available in any project that has the moderation bundle installed. See Bundles to add it.Usage Example
Parameters
string
required
The ID of the user to block or unblock. The hook will not run if this equals the current user’s ID.
Returns
boolean | null
Whether the current user blocks the target user.
null while the initial status check is in progress.boolean
true while the initial block status is being fetched.() => Promise<void>
Blocks the user if not currently blocked, or unblocks if currently blocked. No-ops if loading or if
userId equals the current user’s ID.The current user must be signed in for this hook to function. The hook performs no action if the
userId matches the authenticated user’s own ID.
