返回最近的路由 loader 或 clientLoader 中的数据。
import { useLoaderData } from "react-router";
export async function loader() {
return await fakeDb.invoices.findAll();
}
export default function Invoices() {
let invoices = useLoaderData<typeof loader>();
// ...
}
function useLoaderData<T = any>(): SerializeFrom<T>
从路由的 loader 或 clientLoader 函数返回的数据