#How to pass data of the client component to server component
21 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
you cant pass data from client components to server components in conventional means. you have to do it by interacting with the URL itself, for example by adding a search query
and if you want to pass sensitive data?
or for example if i want to do a sign up page, my form is a client component and i have to pass the data throw URL to have it in the server component and save it to the BBDD?
what is BBDD?
database*
well, you can save it in the database
essentially, this is a restriction that you must abide by: server components only know the data present in the http request, which includes the URL and the http headers (including cookies). server components cannot know anything else, such as client-side states
so i can use cookies to do that?
i think is a better way, If I want to pass a lot of information from the client components to the server components
right?
yes cookies is also a valid way to pass data, yes
though if you want to hide it from the user, then cookies won't hide anything. users can always check the cookies content
and what do you recomend to do a sign up and login page?
form => use server actions to handle the submission
oh, so i dont need a client component to handle the page in this case?
you can use a client component or a server component to make the form, no issues with either
ok, ty for the help mate 😄
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1231644187519094804 message)
Not sure if im allowed to ask a question on a already solved question. But I have a page (server comp) and a client component within it that has a form which uses some client validation. When a user submitts that form. Another server component on the same page needs that data.
Client form > Submit data > Perform query to database > Server component needs the returned data
What's the best solution then?