Skip to content
Discussion options

You must be logged in to vote

In the App Router, components are React Server Components by default, and Server Components can't use state, effects, or event handlers — those only run on the client. Add the "use client" directive at the very top of the file for any component that needs useState/useEffect/onClick, and keep it as a small leaf so most of your tree stays server-rendered.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Kevinchamplin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant