useLoaderData
useLoaderData
.
This hook returns the JSON parsed data from your route loader function.
import { json } from "@remix-run/node"; // or cloudflare/deno
import { useLoaderData } from "@remix-run/react";
export async function loader() {
return json(await fakeDb.invoices.findAll());
}
export default function Invoices() {
const invoices = useLoaderData<typeof loader>();
// ...
}
useLoaderData
docs.