react-query-questions
solid-query-questions
table-questions
virtual-questions
router-questions
react-charts-questions
ranger-questions
vue-query-questions
svelte-query-questions
bling-questions
form-questions
angular-query-questions
start-questions
db-questions
start-showcase
router-showcase
๐ฃ-announcements
'rules-of-hooks' ESLint rule conflicts with inline route components
plugin-hooks/recommended
is used, the following code causes an ESLint error:const Route = createRoute({
component: () => {
useState() // React Hook "useState" is called in function "component" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". eslintreact-hooks/rules-of-hooks
const Route = createRoute({
component: () => {
useState() // React Hook "useState" is called in function "component" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". eslintreact-hooks/rules-of-hooks
Abort preload when navigating to different route
queryClient.ensureQueryData
. This loader is triggered with I hover over the Link component (because of the preload functionality).
```tsx
......TanStack Router Docs Wrong? - Auth Example

Updated routes broke my application.
routeTree.gen.ts
to regenerate it....
Do you typically put route components inline or import external components ?
Loading data in router using tanstack-query but need api token from react hook
loader
method. However, my scenario is that accessing my API server requires a JWT token and the only method I have available for that is a react hook. Since the loader isn't a react component, I can't straightforwardly call my getToken()
method from there.
I'm keen on being able to do this so if anyone has any suggestions I'd appreciate hearing them. For one thing, I'd need this in order to do any data loading via the router. For another, my current use case is that I need to load data in the router so that I can dynamically populate my breadcrumb trail. The idea is that when accessing the path /entity/{id}
, the router can look up the relevant entity by its id and display e.g. its name or title in the breadcrumb trail. In principle, this can work (see e.g. https://github.com/TanStack/router/discussions/895). But not being able to access the getToken()
method is currently preventing me from doing this in the most obvious way.
For context, I'm using axios to handle my API calls and I have a useEffect()
in my root route (routes/__root.tsx
) which adds an interceptor to my axios instance which calls getToken()
and then adds it to the axios request as an authorization header. This works for regular uses of useQuery
within my react components and pages. But I can't figure out how to make it work in the router's loader
method. Any ideas would be much appreciated!...How to get route context correctly typed?
match.routeContext
gets its type? I was reading the documentation about "Processing Accumulated Route Context" and from my understanding the type should extend the Router Context defined in createRootRouteWithContext
. But I get an error if I try to access the properties that I define in Router Context. Should I define the correct type somewhere else?
Edit: I made a codesandbox...
getting issue with pending component
possibility to check if can go back
Nested route group navigation
How to configure router with queryClient in context?
Why providing queryClient as context
createRouter
context.
I wonder why should a user do that? The entire app inclusively the router can use the queryClient directly?
```ts
//https://tanstack.com/router/latest/docs/framework/react/examples/basic-react-query-file-based...Styling parent of <Link> with active state
Using TSR in an existing app that already uses GET param routing
example.com/?module=foo
. The module=foo
param will always be there and i'd like to make TSR use additional GET params to store the current client-side-only route / parameters, e.g. example.com/?module=foo&page=about
.
Is this possible?...Typing issue with IntelliJ IDEA
How to invalidate route from the __root.tsx?
/about
page and there's no internet connection, I render ErrorComponent
but I'd like to reload this page once I'm online again (so it's when I get message from sw)
That's what I tried:
```...Accessing Path Params For Component in createRoute