T
TanStack17mo ago
ambitious-aqua

"The useLoaderData hook accepts a single optional argument" - TypeScript says it's not optional

8 Replies
constant-blue
constant-blue17mo ago
yes, you need to pass either from to specifiy a route where you want to get the loader data from, or strict: false to get a union of everything
ambitious-aqua
ambitious-aquaOP17mo ago
i totally understand why an argument is required (at least for type safety), but why do the docs say "optional" and even italicize it?
constant-blue
constant-blue17mo ago
docs are wrong
extended-salmon
extended-salmon17mo ago
PR to fix the docs is always welcome
extended-salmon
extended-salmon17mo ago
useMatch hook | TanStack Router React Docs
The useMatch hook returns a RouteMatch in the component tree. The raw route match contains all of the information about a route match in the router and also powers many other hooks under the hood like useParams, useLoaderData, useRouteContext, and useSearch. useMatch options
ambitious-aqua
ambitious-aquaOP17mo ago
hope i'll remember to try to make a PR when i'm not on my work computer i can't (easily) contribute to anything from here
extended-salmon
extended-salmon17mo ago
no worries I fixed this
ambitious-aqua
ambitious-aquaOP17mo ago
thank you 🙏

Did you find this page helpful?