Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Don't remove useLoaderData from other components in the route file #3

Closed
Tracked by #2
KubaJastrz opened this issue Jun 26, 2024 · 0 comments
Closed
Tracked by #2
Labels
bug Something isn't working

Comments

@KubaJastrz
Copy link
Owner

Epic-stack example: https://github.com/epicweb-dev/epic-stack/blob/3649cb9217084ed57055c76f237289525b252e2f/app/routes/settings%2B/profile.index.tsx#L220

Simplified example:

import { useLoaderData } from '@remix-run/react';

export const loader = () => 42;

export default function Route() {
  const data = useLoaderData<typeof loader>();  // <- safe to remove
}

function Internal() {
  const data = useLoaderData<typeof loader>();  // <- don't remove this
}

export function Exported() {
  const data = useLoaderData<typeof loader>();  // <- don't remove this
}

Same applies to useActionData of course.

@KubaJastrz KubaJastrz added the bug Something isn't working label Jun 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant