1.0.3-beta.0 • Published 8 months ago
@sskmy1024y/trpc-swr-client v1.0.3-beta.0
trpc-swr
Documentation: https://trpc-swr.vercel.app/
Installation
npm install @trpc-swr/client
# Peer deps
npm install swr @trpc/client @trpc/server
Usage
// profile.tsx
import { trpc } from "./trpc";
const Profile = (props: { userId: string }) => {
const { data, isLoading } = trpc.user.get.useSWR({ id: props.userId });
return (
<div>
Name:{" "}
{!data && isLoading
? "loading..."
: data
? data.name
: "User does not exist"}
</div>
);
};
1.0.3-beta.0
8 months ago