T
TanStack3w ago
genetic-orange

"createRouter is not a function" after updating to `@tanstack/react-router-ssr-query`

Here is my router.tsx file
import { QueryClient } from "@tanstack/react-query";
import { createRouter } from "@tanstack/react-router";
import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";
import { routeTree } from "./routeTree.gen";

export function createAppRouter() {
const queryClient = new QueryClient();
const router = createRouter({
routeTree,
// optionally expose the QueryClient via router context
context: { queryClient },
scrollRestoration: true,
defaultPreload: "intent",
});

setupRouterSsrQueryIntegration({
router,
queryClient,
});

return router;
}
import { QueryClient } from "@tanstack/react-query";
import { createRouter } from "@tanstack/react-router";
import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";
import { routeTree } from "./routeTree.gen";

export function createAppRouter() {
const queryClient = new QueryClient();
const router = createRouter({
routeTree,
// optionally expose the QueryClient via router context
context: { queryClient },
scrollRestoration: true,
defaultPreload: "intent",
});

setupRouterSsrQueryIntegration({
router,
queryClient,
});

return router;
}
4 Replies
adverse-sapphire
adverse-sapphire3w ago
Should it be createRouter instead of createAppRouter?
genetic-orange
genetic-orangeOP3w ago
Ah thank you very, that solved my problem, however in this case the problem is in the documentation: https://tanstack.com/router/latest/docs/integrations/query#setup
unwilling-turquoise
unwilling-turquoise3w ago
well the docs are for router, not start anyhow, this interface will change soon
genetic-orange
genetic-orangeOP3w ago
Ah I understand, I misunderstood because I found this link in the Tanstack Start discussion: https://github.com/TanStack/router/discussions/2863#discussioncomment-14051299
GitHub
Start BETA - Tracking · TanStack router · Discussion #2863
Tracking any important changes for TanStack Start during the BETA period. If you are coming from the ALPHA of TanStack Start, you can see all the breaking changes that were made here - #2403

Did you find this page helpful?