Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Created April 5, 2024 19:40
Show Gist options
  • Save PaulieScanlon/b2538b0e6df41210d3e5c85b8ee8c786 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/b2538b0e6df41210d3e5c85b8ee8c786 to your computer and use it in GitHub Desktop.
Example Remix Route
// app/routes/_index.jsx
import { useLoaderData } from '@remix-run/react';
import { json } from '@remix-run/node';
import ParentComponent from '../components/parent-component';
const Page = () => {
const { data } = useLoaderData();
return <ParentComponent data={data} />;
};
export const loader = async () => {
const response = await fetch('https://api.github.com/repos/remix-run/remix');
const data = await response.json();
return json({
data,
});
};
export default Page;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment