Skip to content
Discussion options

You must be logged in to vote

Yeah, there is no MetaArgs type like LoaderArgs, etc.

However, you can use the utility type UseDataFunctionReturn to get the correct type. It's not exported by default, so you'll need a deep import.

import { type UseDataFunctionReturn } from "@remix-run/react/dist/components";

export const meta = ({
  data,
}: {
  data: UseDataFunctionReturn<typeof loader>;
}) => {
  return {
    title: data.greeting,
  };
};

As for why it's in the react package, it's most likely because it was needed primarily for the useLoaderData hook, which is implemented there. Accessing the serialized data is done at the component level.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@smowli
Comment options

@kiliman
Comment options

@ofekdeitch
Comment options

@alecananian
Comment options

@AlexanderMusienko
Comment options

Answer selected by smowli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants