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.

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.
string
Optional. Resolves the returned user’s reputation into a spaceReputation number. Accepts a space <uuid> or "none" (project-general bucket) only — "context" is rejected with a 400 on this endpoint. Empty string, "general", and null are also rejected. See Reputation.
boolean
Optional. When true, spaceReputation is the subtree sum (the space plus all its descendants). Only honored when spaceReputationId is an explicit <uuid>.

Returns

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