"The useLoaderData hook accepts a single optional argument" - TypeScript says it's not optional
The docs that say this: https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook#useloaderdata-options
When i use it:

8 Replies
sensitive-blue•14mo 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 everythingwise-whiteOP•14mo 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?
sensitive-blue•14mo ago
docs are wrong
rare-sapphire•14mo ago
PR to fix the docs is always welcome
rare-sapphire•14mo ago
should be similar to https://tanstack.com/router/v1/docs/framework/react/api/router/useMatchHook
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
wise-whiteOP•14mo 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
rare-sapphire•14mo ago
no worries I fixed this
wise-whiteOP•14mo ago
thank you 🙏