Next.js Discord

Discord Forum

onClick on Server Components?

Unanswered
pxL posted this in #help-forum
Open in Discord
pxLOP
While building:
If I don't use "use server" it yells to use "use client" for having any event listeners like onClick.
But If I just add "use server", it builds successfully.

Output: Div remains inactive as expected.

Doubt: why not yell the same error in the 2nd case as well?

Cuz wouldn't the absence of the error indicate there's no event handling error anymore and give false assumption to the user that it would work now (which as observed doesn't)?

0 Replies