π Remix: Loader + Action + UI Update (Flow)

1. Loader
Runs on
GET
requests.Provides data to the component through
useLoaderData()
.
2. Action
Runs on
POST/PUT/DELETE/PATCH
.Handles mutations (form submissions, API calls).
Returns response (redirect, data, or error).
π Internal Flow (Submit β UI Update)
User submits form
β Browser sends request with method =POST
(orPUT
, etc).Remix calls
action
of that route
β Code insideaction
mutates data (DB, API, etc).
βaction
returns either:redirect("/path")
β navigates + runs target routeβs loader.JSON/data β stays on the same route.
After action finishes
β Remix automatically revalidates loaders.If same route: re-runs that routeβs loader.
If redirect: runs the loader of the target route.
Loader returns fresh data
β Passed to the component viauseLoaderData()
.React re-renders with new data
β β UI updates without page reload.
3. Special Cases
useFetcher.submit
β triggers action without full navigation, then only revalidates necessary loaders.shouldRevalidate
β lets you skip revalidation if you donβt want loader to run.If loader returns same data β UI looks unchanged (but it still ran).
π Key Idea
Action = mutate data
Loader = fetch fresh data
Remix stitches them together β UI syncs automatically after submission.
Subscribe to my newsletter
Read articles from Abhinav Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Abhinav Kumar
Abhinav Kumar
π B.Tech CSE | π¨βπ» Learning DSA & C++ | π Building projects & writing what I learn | π Currently solving LeetCode & exploring Git/GitHub