Skip to main content

Overview

useFetchUserByUsername returns a function that fetches a user’s public profile by their username. Use this for public profile pages where the URL contains a username slug.
If the profile owner has blocked the signed-in caller, this returns 404 — the same response as a user who does not exist. The reverse is not true: a user you have blocked stays visible, so you keep a way to find and unblock them. Requires the moderation bundle.

Usage Example

Parameters

The hook returns a function. That function accepts:
string
required
The username to look up.
string | string[]
Optional. Pass "files" to populate avatarFile and bannerFile with full File objects.

Returns

User
The user’s public profile. When spaceReputation is requested, it carries an added spaceReputation number. See User data model and Reputation.