import React from 'react'; import { cookies, headers } from 'next/headers'; export default async function Component() { async function handleClick() { 'use server'; (await cookies()).set('user-id', 'encrypted-id'); } return ( <>

Cookies:

{(await cookies()).getAll().map(({ name, value }) => { return (

Name: {name} Value: {value}

); })}

Headers:

{Array.from((await headers()).entries()).map(([name, value]: [string, string]) => { return (

Name: {name} Value: {value}

); })}
); }