Step 14 - Client and server components
Course: NextJS (Client side) - chapter 14
Ref - https://nextjs.org/learn/react-foundations/server-and-client-components
NextJS expects you to identify all your components as either client or server
As the name suggests
- Server components are rendered on the server
- Client components are
pre-renderedand are pushed to the client to be rendered again By default, all components areservercomponents.
If you wan’t to mark a component as a client component, you need to add the following to the top of the component -
"use client"When should you create client components ?
- Whenever you get an error that tells you that you need to create a client component
- Whenever you’re using something that the server doesn’t understand (useEffect, useState, onClick…) Rule of thumb is to defer the client as much as possible

Assignment
Section titled “Assignment”Try updating components/Signin.tsx to make it a client component
You will notice that the error goes away
Some nice readings -