Open nwaokoron opened 1 month ago
Since you're new to Next.js this might be your first encounter with Server Actions https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations#event-handlers
They're great, it makes it so you can write vanilla functions that run on your server and call them from your client side, instead of having to make a bunch of API endpoints and HTTP calls. That all happens behind the scenes. Once you're comfortable with server actions it's really hard to go back to API routes!
https://github.com/vercel/nextjs-subscription-payments/blob/25a19504c85a2353f23e907521d0cdb1979c66d6/components/ui/Navbar/Navlinks.tsx#L4
Pretty new to Next.js. I thought importing a server component in a client component would cause an error but this code seems to allow it. How so?