import { useLoaderData } from "@remix-run/react"; import type { ErrorBoundaryComponent, LoaderArgs } from "@remix-run/server-runtime"; import { json } from "@remix-run/server-runtime"; import VideoList from "~/components/VideoList/VideoList"; import { getVideos } from "~/lib/getVideos"; export const loader = async ({ context, request }: LoaderArgs) => { const data = await getVideos(request); return json(data); }; export default function Index() { const { data: videos } = useLoaderData(); // console.log(videos); return (
); } export const ErrorBoundary: ErrorBoundaryComponent = ({ error }: { error: Error }) => { console.warn(error); return (

Error:

{error.message}

); };