Hey, I'm trying to wrap my head around client vs server components in my app. Here's the basic structure I'm using:
{DetailsView} - type = server - grabs data from various sources {DetailsViewForm} - type = client - Receives data as props from parent server component - User React Hook Form
{DetailsView} - type = server - grabs data from various sources {DetailsViewForm} - type = client - Receives data as props from parent server component - User React Hook Form
This approach works well for returning the data in a clean and fast way while allowing for interactivity in the form. Where I'm getting lost is how to submit the form. I can submit it client side with the
useMutate
useMutate
hook, but then I'm not sure how to fetch new data.
It seems more ideal to use the server
mutate
mutate
function instead, but I can't figure out how to call that from a client component.
I can make this all work with client components, but it seems like the direction of the App router in Next.js is to move toward server components.