useOrganizationList()
import { useOrganizationList } from '@auth/clerk'- useOrganizationList()
Access the current user’s organizations and manage the active organization with a universal import path (via ClerkAuthContext). Pass the same options you would pass to Clerk’s hook (for example { userMemberships: true } when you need membership rows).
Usage
OrgListExample.tsx
import { useOrganizationList } from '@auth/clerk'
export const OrgListExample = () => {
const { isLoaded, setActive, userMemberships } = useOrganizationList({ userMemberships: true })
if (!isLoaded) return null
return (
<View>
{userMemberships?.data?.map((m) => (
<Button
key={m.id}
title={m.organization.name || m.organization.id}
onPress={() => setActive?.({ organization: m.organization.id })}
/>
))}
</View>
)
}API
Returned values (selection)
Depends on which options you pass; see Clerk’s docs. Common fields include:
isLoaded: boolean— Whether the hook is ready.userMemberships— When requested, includesdatarows withorganizationand membership fields.setActive— Set the active organization (ornull).
See official docs for full details: https://clerk.com/docs/nextjs/reference/hooks/use-organization-list
Last updated on
