Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Why does this code not throw an error? #367

Closed
nwaokoron opened this issue Aug 19, 2024 · 1 comment
Closed

Why does this code not throw an error? #367

nwaokoron opened this issue Aug 19, 2024 · 1 comment

Comments

@nwaokoron
Copy link

import { SignOut } from '@/utils/auth-helpers/server';

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?

@k-thornton
Copy link
Contributor

k-thornton commented Aug 23, 2024

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!

@leerob leerob closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants