Skip to main content

Overview

useJoinSpace returns a callable function for joining a space. If the space has requireJoinApproval: true, the membership is created with status: "pending" until approved by a moderator or admin. Otherwise, it is immediately active. A private space can’t be joined: joining a space the user can’t see answers 404 space/not-found, and its moderators and admins add members with useAddMember.
When using SpaceProvider, call joinSpace from useSpace — it then fetches the space again, so the space’s memberPermissions and member count reflect the change.

Usage Example

Parameters

string
required
UUID of the space to join.

Returns

Resolves with the user’s membership record, as a SpaceMember object: id, spaceId, userId, role ("member" for a new membership, the existing role on a repeat join), status ("pending" or "active"), joinedAt and createdAt. Joining again as an active member, or with a request already awaiting approval, is not an error: it resolves with the existing membership, unchanged, the same record a fresh join gives. A banned user gets 403 space/banned. The response carries no permissions. To read what the user may do in the space now, fetch the space again: its memberPermissions describe them (a request awaiting approval reports status: "pending" and isMember: false). joinSpace from useSpace does this for you.