
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@apollo/client-integration-react-router
Advanced tools
This package provides integrations between Apollo Client and React Router 7 to support modern streaming SSR.
This package provides integrations between Apollo Client and React Router 7 to support modern streaming SSR.
Install dependencies:
npm i @apollo/client-integration-react-router @apollo/client graphql
Create an app/apollo.ts with that exports a makeClient function and an apolloLoader created with createApolloLoaderHandler:
import { ApolloLink, HttpLink, InMemoryCache } from "@apollo/client";
import {
createApolloLoaderHandler,
ApolloClient,
} from "@apollo/client-integration-react-router";
// `request` will be available on the server during SSR or in loaders, but not in the browser
export const makeClient = (request?: Request) => {
return new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({ uri: "https://your.graphql.api" }),
});
};
export const apolloLoader = createApolloLoaderHandler(makeClient);
[!IMPORTANT]
ApolloClientneeds to be imported from@apollo/client-integration-react-router, not from@apollo/client.
Run yarn react-router reveal. This will create the files app/entry.client.tsx and app/entry.server.tsx.
Adjust app/entry.client.tsx:
+import { makeClient } from "./apollo";
+import { ApolloProvider } from "@apollo/client";
startTransition(() => {
+ const client = makeClient();
hydrateRoot(
document,
<StrictMode>
+ <ApolloProvider client={client}>
<HydratedRouter />
+ </ApolloProvider>
</StrictMode>
);
});
Adjust app/entry.server.tsx:
+import { makeClient } from "./apollo";
+import { ApolloProvider } from "@apollo/client";
export default function handleRequest(
// ...
) {
return new Promise((resolve, reject) => {
// ...
+ const client = makeClient(request);
const { pipe, abort } = renderToPipeableStream(
+ <ApolloProvider client={client}>
<ServerRouter
context={routerContext}
url={request.url}
abortDelay={ABORT_DELAY}
/>,
+ </ApolloProvider>,
{
[readyOption]() {
shellRendered = true;
Add <ApolloHydrationHelper> to app/root.tsx
+ import { ApolloHydrationHelper } from "@apollo/client-integration-react-router";
export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
// ...
<body>
- {children}
+ <ApolloHydrationHelper>{children}</ApolloHydrationHelper>
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
apolloLoader with useReadQueryYou can now use the apolloLoader function to create Apollo-enabled loaders:
export const loader = apolloLoader<Route.LoaderArgs>()(({ preloadQuery }) => {
const myQueryRef = preloadQuery(MY_QUERY, {
variables: { someVariable: 1 },
});
return {
myQueryRef,
};
});
[!IMPORTANT]
To provide you with better TypeScript support, this is a method that you need to call twice:apolloLoader<LoaderArgs>()(loader)
Then you can consume this myQueryRef object with useReadQuery in your component:
export default function Home() {
const { myQueryRef } = useLoaderData<typeof loader>();
const { data } = useReadQuery(myQueryRef);
return (
<div> do something with `data` here </div>
)
FAQs
This package provides integrations between Apollo Client and React Router 7 to support modern streaming SSR.
The npm package @apollo/client-integration-react-router receives a total of 489 weekly downloads. As such, @apollo/client-integration-react-router popularity was classified as not popular.
We found that @apollo/client-integration-react-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.