#How to pass data of the client component to server component

21 messages · Page 1 of 1 (latest)

stark python
#

I know that if you want to use a server component inside a client component, you must wrap it, but how i suppose to pass the data, if i have it in States in the client component?

vivid estuaryBOT
#

🔎 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)

bleak zenith
stark python
#

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?

bleak zenith
#

what is BBDD?

stark python
#

database*

bleak zenith
#

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

stark python
#

i think is a better way, If I want to pass a lot of information from the client components to the server components

#

right?

bleak zenith
#

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

stark python
#

and what do you recomend to do a sign up and login page?

bleak zenith
stark python
#

oh, so i dont need a client component to handle the page in this case?

bleak zenith
#

you can use a client component or a server component to make the form, no issues with either

stark python
#

ok, ty for the help mate 😄

vivid estuaryBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1231644187519094804 message)

severe moon
#

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?