2.0.1 • Published 5 months ago

@trpc-swr/client v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

trpc-swr

tRPC-ified SWR hooks

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>
  );
};
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