#Server-actions and client form

14 messages ยท Page 1 of 1 (latest)

scenic spear
#

How can I use server-actions with a client form component?

timber geyser
scenic spear
#

I have two slides, and a state variable determines what slide is active. ๐Ÿ˜‰

#

the form is made up of these two slides

#

the thing is that I would like to toggle between two "slides"

#

achieve that with server components? I don't know.

timber geyser
#

Depends, if both slides are in the DOM and hidden with CSS, so the formData includes both, then yes. Alternatively each slide could be its own form. There are probably various ways to achieve it depending on exactly what you're trying to do.

But, if you want to keep your existing code as similar as you currently have, then you can go the useTransition route

scenic spear
#

so useTransition makes it possible to run a server action from within a client component?

#

I would choose the css method!! ๐Ÿ˜„

#

can I use variables instead of state?

#

because state can only be in client components?

scenic spear
#

have found a solution.

#

thank you!

broken yarrow