Files
Janka UrygaandGitHub 82e84e430b feat(after): stabilize unstable_after (#73605)
- rename `unstable_after` -> `after`
- remove `experimental.after` flag (and warn if it's present)

i separated the big find-and-replace into a separate commit so that it's
easier to see what else changed apart from that.

does not touch docs, that's in #73038
2024-12-06 19:59:57 +00:00

24 lines
474 B
TypeScript

import { after } from 'next/server'
import { cookies } from 'next/headers'
import * as React from 'react'
export const dynamic = 'force-dynamic'
async function action() {
'use server'
const cookieStore = await cookies()
after(async () => {
cookieStore.set('illegalCookie', 'too-late-for-that')
})
}
export default async function Page() {
return (
<>
<form action={action}>
<button type="submit">Submit</button>
</form>
</>
)
}