--- title: Actions order: 6 --- # Actions [MODES: framework] ## Introduction Data mutations are done through Route actions. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it. Route actions defined with `action` are only called on the server while actions defined with `clientAction` are run in the browser. ## Client Actions Client actions only run in the browser and take priority over a server action when both are defined. ```tsx filename=app/project.tsx // route('/projects/:projectId', './project.tsx') import type { Route } from "./+types/project"; import { Form } from "react-router"; import { someApi } from "./api"; export async function clientAction({ request, }: Route.ClientActionArgs) { let formData = await request.formData(); let title = formData.get("title"); let project = await someApi.updateProject({ title }); return project; } export default function Project({ actionData, }: Route.ComponentProps) { return (
{actionData.title} updated
) : null}{actionData.title} updated
) : null}