Functions: refresh
Functions: refresh | Next.js
섹션 제목: “Functions: refresh | Next.js”Source URL: https://nextjs.org/docs/app/api-reference/functions/refresh
Copy page
refresh
섹션 제목: “refresh”마지막 업데이트 2026년 2월 20일
refresh는 서버 액션 내부에서 클라이언트 라우터를 새로 고칠 수 있게 해줍니다.
사용법
섹션 제목: “사용법”refresh는 오직 서버 액션 내부에서만 호출할 수 있습니다. 라우트 핸들러, 클라이언트 컴포넌트 또는 다른 어떤 컨텍스트에서도 사용할 수 없습니다.
매개변수
섹션 제목: “매개변수” refresh(): void;반환값
섹션 제목: “반환값”refresh는 값을 반환하지 않습니다.
app/actions.ts
JavaScriptTypeScript
'use server'
import { refresh } from 'next/cache'
export async function createPost(formData: FormData) { const title = formData.get('title') const content = formData.get('content')
// Create the post in your database const post = await db.post.create({ data: { title, content }, })
refresh() }서버 액션 외부에서 사용하면 발생하는 오류
섹션 제목: “서버 액션 외부에서 사용하면 발생하는 오류”app/api/posts/route.ts
JavaScriptTypeScript
import { refresh } from 'next/cache'
export async function POST() { // This will throw an error refresh() }supported.
Send