Server Actions
Clerk provides helpers to allow you to protect your Server Actions, fetch the current user, and interact with the Clerk API.
Below are some examples of usage both in Server Components or Client Components.
With server components
Protect your actions
Accessing the current user
Current user data is important for data enrichment. You can use the currentUser()
helper to achieve this.
With Client Components
When using Client Components, you need to make sure you use prop drilling to ensure that headers are available.
Protect your actions
Server Action code
Feedback
Last updated on