2.0.1 • Published 5 months ago
@trpc-swr/ssr v2.0.1
@trpc-swr/ssr
Framework agnostic SSR for trpc-swr.
Documentation: https://trpc-swr.vercel.app/server-side/next-13-appdir
Usage
Define a helper function to create a new trpc
ssr instance for each request.
In server/ssr.ts
import { createProxySSGHelpers } from "@trpc-swr/ssr";
import { appRouter } from "server/appRouter";
export const createSSR = () => {
return createProxySSGHelpers({
router: appRouter,
ctx: {},
});
};
In a page
import { createSSR } from "<trpc-ssr-location>";
const getData = () => {
const rsc = createSSR();
return rsc.home.getVersion.fetch();
};
export default async function HomePage() {
const version = await getData();
return <div>{version}</div>;
}
3.0.0-canary.1
5 months ago
3.0.0-canary.0
5 months ago
2.0.1
7 months ago
2.0.0
7 months ago
1.0.2
11 months ago
1.0.1
12 months ago
1.0.0
12 months ago
1.0.0-rc.2
1 year ago
1.0.0-rc.1
1 year ago
1.0.0-rc.0
1 year ago