← 문제 목록
초급 Next.js 30P

서버 액션 함수 위치 오류

다음 코드에서 버그를 찾으세요:
JAVASCRIPT
// app/form/page.js
'use client';

async function submitForm(formData) {
    'use server';
    const name = formData.get('name');
    await saveToDatabase(name);
}

export default function FormPage() {
    return (
        <form action={submitForm}>
            <input name="name" />
            <button type="submit">저장</button>
        </form>
    );
}

답변

로그인 후 제출하기
0명 풀이 · 정답률 0%