• Blog
  • Documentation
  • Courses
  • Changelog
  • AI Starters
  • UI Kit
  • FAQ
  • Supamode
    New
  • Pricing

Launch your next SaaS in record time with Makerkit, a React SaaS Boilerplate for Next.js and Supabase.

Makerkit is a product of Makerkit Pte Ltd (registered in the Republic of Singapore)Company Registration No: 202407149CFor support or inquiries, please contact us

About
  • FAQ
  • Contact
  • Verify your Discord
  • Consultation
  • Open Source
  • Become an Affiliate
Product
  • Documentation
  • Blog
  • Changelog
  • UI Blocks
  • Figma UI Kit
  • AI SaaS Starters
License
  • Activate License
  • Upgrade License
  • Invite Member
Legal
  • Terms of License
    • Reactfire
    • useCurrentOrganization
    • useCurrentUserRole
    • useIsSubscriptionActive
    • useUserSession
    • withAppProps
    • withTranslationProps
    • withAuthProps
    • withPipe
    • withMethodsGuard
    • withAuthedUser
    • withExceptionFilter
    • withCsrf

useCurrentUserRole

The "useCurrentUserRole" custom hook allows you to get the current user role within the selected organization

In case you need to access the current user role within the current organization, you can use the useCurrentUserRole hook.

To use this hook, simply import it from the ~/lib/organizations/hooks/use-current-user-role module, and then call it from your component.

Here's an example:

import { useCurrentUserRole } from '~/lib/organizations/hooks/use-current-user-role';
function MyComponent() {
const role = useCurrentUserRole();
return (
<div>
<p>Current user role: {role}</p>
</div>
);
}

n this example, the useCurrentUserRole hook is used to retrieve the current user's role within their current organization.

Overall, the useCurrentUserRole hook is a convenient and easy-to-use way to retrieve the role of the current user within their current organization in your Next.js app.