Build a custom flow for managing a user's organization invitations
This guide will demonstrate how to use Clerk's API to build a custom flow for managing a user's organization invitations.
The following example uses the useOrganizationList()
hook to get userInvitations
, which is a list of the user's organization invitations.
userInvitations
is an object with data
that contains an array of UserOrganizationInvitation
objects.
Each UserOrganizationInvitation
object has an accept()
method that accepts the invitation to the organization.
This example is written for Next.js App Router but can be adapted for any React meta framework, such as Remix.
The following example:
- Calls the
getOrganizationInvitations()
method to retrieve the list of organization invitations for the active user. This method returnsdata
, which is an array ofUserOrganizationInvitation
objects. - Maps over the
data
array to display the invitations in a table. - Provides an "Accept" button for each invitation that calls the
accept()
method.
Use the following tabs to view the code necessary for the index.html
and main.js
files.
Feedback
Last updated on