An App Router page reads questions from MySQL and displays an interactive filter. The filter uses state, but the database client must remain on the server. Should the whole page have "use client", or just the filter? What can be passed between them?
Editorial starter question from DevCircle, provided for learning and discussion.
The filter module starts with "use client" and can use state. Its imports belong to the client module graph, so never import the database client there. Pass only necessary React-serializable fields, never secrets or unrestricted user records. This filter searches only the supplied rows; searching the complete dataset requires a server query.