2.0.1 • Published 2 years ago

@trpc-swr/client v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

3.0.0-canary.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-rc.2

2 years ago

1.0.0-rc.1

2 years ago

1.0.0-rc.0

2 years ago