your recipe card header background

    Create Component with loader function

    0

    0

    Jose Romero

    Remix TypeScript public recipes

    The code exports a function called loader which takes an asynchronous function as its only argument. The function returns a JSON object.

    Library: remix

    Shortcut: remix.component.with_loader.create

    import { json, LoaderFunction, useLoaderData } from "remix";
    
    export const loader: LoaderFunction = async ({ params }) => {
      const myData = {};
      return json(myData);
    };
    export default function Component() {
      const data = useLoaderData();
      return <main></main>;
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.