#Server-actions and client form
14 messages ยท Page 1 of 1 (latest)
It means you lose progressive enhancement though.
Does the form need to be a client component?
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.
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
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?
just to mention, you dont need to use this transition thing:
https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions#props