Next.js · Middle · Question 47 of 75
Where does a client component's code run on the first page load?
- ✓Correct answer: Both on the server (for HTML) and in the browser (hydration)
- 2Only in the browser; it's skipped on the server
- 3Only on the server; the browser gets ready HTML without JS
Explanation
'use client' doesn't mean "client only": the component is prerendered to HTML on the server and then hydrated. That's why you can't access window during render without checks - use effects or next/dynamic with ssr: false.