Build a custom flow for viewing a user's organization memberships
Warning
This guide is for users who want to build a custom user interface using the Clerk API. To use a prebuilt UI, use the Account Portal pages or prebuilt components.
This guide will demonstrate how to use the Clerk API to build a custom flow for viewing the list of a user's organization memberships.
Next.js
JavaScript
The following example:
Uses the useOrganizationList() hook to get memberships, which is a list of the current user's organization memberships.
memberships returns data, which is an array of OrganizationMembership objects.
Maps over the data array to display the user's organization memberships in a table.
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 getOrganizationMemberships() method to retrieve the list of organizations the current user is a part of. This method returns data, which is an array of OrganizationMembership objects.
Maps over the data array to display the user's organization memberships in a table.
Use the tabs to view the code necessary for the index.html and main.js files.