Next.js · Middle · Question 29 of 75

How does <Form> from next/form differ from a plain <form> for a search form?

Explanation

<Form action="/search"> turns the fields into searchParams and performs an SPA navigation that keeps the shared layout, instead of a full reload. It prefetches shared UI (e.g. loading.tsx). Without JS it works like a regular form. With a function in action, it behaves like a React form with a Server Action.

Further reading

Problem with a question

Next.js · Middle · question 29

Test yourself

Take the Next.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz