dev
json

json

A shortcut for:

new Response(JSON.stringify(someValue), {
  headers: {
    "Content-Type": "application/json; utf-8",
  },
});

Typically used in loaders:

import { json } from "react-router-dom";

const loader = async () => {
  const data = getSomeData();
  return json(data);
};

See also:

Docs and examples CC 4.0
Edit