• Returns the data from the closest route loader or client loader.

    import { useLoaderData } from "react-router"

    export async function loader() {
    return await fakeDb.invoices.findAll();
    }

    export default function Invoices() {
    let invoices = useLoaderData<typeof loader>();
    // ...
    }

    Type Parameters

    • T = any

    Returns SerializeFrom<T>