ActionFunctionArgs
Request arguments supplied to a server action.
Compatibility
ReactAvailable in this renderer's browser integration.
React SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
PreactAvailable in this renderer's browser integration.
Preact SSRAvailable to this renderer's SSR integration; browser event handlers run after hydration.
Import from @kasperrt/smolter/react @kasperrt/smolter/preact
Signature
type ActionFunctionArgs = LoaderFunctionArgs;Contract
Aliases LoaderFunctionArgs. request carries the mutation method and body; params identifies the matched route; signal cancels work when the request is superseded or disconnected.
import type { ActionFunctionArgs } from "@kasperrt/smolter/preact";
export async function action({ request, params }: ActionFunctionArgs) {
const body = await request.formData();
return { id: params.id, name: String(body.get("name") ?? "") };
}Usage and limits
Read the request body once. Validate user input before mutating application state. Return plain data or data(...) for results and redirect(...) for navigation; a fetcher action result is exposed on that fetcher.