Next.js Discord

Discord Forum

Forms

Unanswered
Dutch Smoushond posted this in #help-forum
Open in Discord
Dutch SmoushondOP
How do I clear forms and give some type of feedback that the form submitted in a server component?

16 Replies

the form need to be client component
or redirect with server component
@Dutch Smoushond How do I clear forms and give some type of feedback that the form submitted in a server component?
you can use server action and redirect with searchparams as the form feedback
if you decide to go without client components
Dutch SmoushondOP
What if both the server action and the component are 'use server'?
Component shouldnt have top level use server
Dutch SmoushondOP
Idk, if you have used supabase but is this line safe to use in a client component
  const supabase = createServerComponentClient({ cookies });
?
I need to better understand what can be used on the client
I dont want to expose sensitive keys
while createClientComponentClient can be used in client component
@Ray while `createClientComponentClient` can be used in client component
Dutch SmoushondOP
Are they not the same or do not use it with cookies?
Nvm
I see it
@Ray while `createClientComponentClient` can be used in client component
Dutch SmoushondOP
Can this be used to get the user sesssion?