T
TanStack4mo ago
correct-apricot

"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
absent-sapphire
absent-sapphire4mo ago
Should it be createRouter instead of createAppRouter?
correct-apricot
correct-apricotOP4mo 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
deep-jade
deep-jade4mo ago
well the docs are for router, not start anyhow, this interface will change soon
correct-apricot
correct-apricotOP4mo 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?