useUnfollowUserByUserId
Overview
TheuseUnfollowUserByUserId hook allows the current logged-in user to unfollow another user using their user ID. This is the most straightforward way to unfollow someone when you know their user ID.
Usage Example
Advanced Usage with Loading State
Usage in User Profile
Bulk Unfollow Usage
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following field:The ID of the user to unfollow
Returns
The function does not return a value but ensures the unfollow action is executed successfully on the server.Error Handling
The hook will throw errors in the following cases:- No project is specified
- No user is logged in
- No user ID is provided
- Attempting to unfollow yourself
Use Cases
This hook is commonly used when:- Building unfollow buttons in user profiles
- Managing following lists with user-centric actions
- Implementing social features in user interfaces
- Creating bulk unfollow functionality
- Building follow/unfollow toggle components
Related Hooks
useUnfollowByFollowId- Unfollow using follow relationship IDuseFollowUser- Follow a useruseFetchFollowStatus- Check if you’re following a useruseFollowManager- Comprehensive follow state management

