State and server components
Answered
Kromfohrländer posted this in #help-forum
KromfohrländerOP
Hello everyone, I have a client component(a calender) which has some state(date, setDate)
Now I have an other client component(a form) which needs that [date] state from the other file. How do I pass this through?
Now I have an other client component(a form) which needs that [date] state from the other file. How do I pass this through?
Answered by Argentine ant
One way you can achieve this, if you don’t want the state to be shareable, is by wrapping the server component and the form client component in a context provider
6 Replies
@Kromfohrländer Hello everyone, I have a client component(a calender) which has some state(date, setDate)
Now I have an other client component(a form) which needs that [date] state from the other file. How do I pass this through?
Argentine ant
One way you can achieve this, if you don’t want the state to be shareable, is by wrapping the server component and the form client component in a context provider
Answer
Argentine ant
so in your server component, add a client component for the interactivity and this can set the value you want to access in your other child component
KromfohrländerOP
Thanks alot @Argentine ant
do you mind accepting my friend req, I have a question that is not really suited for this channel
would really appreciate it
@Kromfohrländer Thanks alot <@217971702733209600>
Argentine ant
no problem!