{({ index, itemName, values, setItemField, canRemove, remove }) => (
{/* Custom element within array item */}
setItemField("weapon", v)}
/>
{canRemove && (
)}
)}
```
## Server-Side Validation
### Basic Action Handler
Actions are defined with `defineAction`, which parses the route params and the body before the
handler runs:
```ts
import { defineAction } from "~/form/define-action.server";
import { idObject } from "~/utils/schema";
import { myFormSchema } from "./my-schemas";
export const action = defineAction(
{ params: idObject, body: myFormSchema },
async ({ params, body }) => {
// params and body are fully typed based on their schemas
await doSomething(params.id, body);
return redirect("/success");
},
);
```
- `params` failing its schema throws a 404. Without a `params` schema the handler gets the raw params.
- `body` failing its schema returns `{ fieldErrors }` when the submitter renders them, otherwise
it throws an error toast redirect. `SendouForm` marks its submissions with
`RENDERS_FIELD_ERRORS_KEY` (`~/form/utils`), so its fields show the errors, while e.g. an
`