useLoaderData
- It returns the data from the nearest loader
- The data would be undefined when the action is not triggered yet
import { useLoaderData } from "@remix-run/react";
export default function MyComponent() {
const data = useLoaderData();
// Display the data
}
Loader Data: {"message":"Hello from loader!"}