new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Next.js · API reference · all subjects

functions: routing

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Prefetching places React Server Component payload in client cache

Next.js prefetching can place a route's React Server Component payload in the client cache before navigation.

Server Functions only accessible via POST method

Behind the scenes, Server Functions use the POST method, and only this HTTP method can invoke them.

Server Functions reachable via direct POST requests

Server Functions are reachable via direct POST requests, not just through the application's UI. Always verify authentication and authorization inside every Server Function.

Pass Server Actions as props to Client Components

You can pass a Server Action to a Client Component as a prop and use it in the form's action attribute.

Server Function invocation methods

There are two main ways to invoke a Server Function: (1) Forms in Server and Client Components using the action prop, and (2) Event Handlers and useEffect in Client Components.

redirect function throws control-flow exception

The redirect function throws a framework-handled control-flow exception. Any code after redirect() won't execute. If you need fresh data, call revalidatePath or revalidateTag beforehand.

Event handlers can invoke Server Functions

Server Functions can be invoked in Client Components using event handlers such as onClick. The Server Function can be awaited to get the result.

Give your agent this brain