your recipe card header background

    Loader with Parameters



    Jose Romero

    Remix JavaScript public recipes

    Defines a loader function that fetch data from an API using the getDataById function.

    Library: remix

    Shortcut: remix.loader.params

    import { json, LoaderFunction } from "remix";
    import invariant from "tiny-invariant";
    export const loader = async ({ params }) => {
      invariant(, "expecting an identifier");
      return json(await getDataById(id));
    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.