import Link from 'next/link' import { signIn, signOut, useSession } from 'next-auth/client' import styles from './header.module.css' // The approach used in this component shows how to built a sign in and sign out // component that works on pages which support both client and server side // rendering, and avoids any flash incorrect content on initial page load. export default function Header () { const [ session, loading ] = useSession() return (

{!session && <> You are not signed in { e.preventDefault() signIn() }} > Sign in } {session && <> {session.user.image && } Signed in as
{session.user.email || session.user.name}
{ e.preventDefault() signOut() }} > Sign out }

) }