@uris-to/client
v0.2.0
Published
A GraphQL and Action Cable client for uris.
Readme
@uris-to/client
A GraphQL and Action Cable client for uris.
npm install @uris-to/clientThe schema is the Ruby app's, dumped and generated against, so the typed documents in here always match the API they were built from.
import { createUris } from "@uris-to/client";
export const client = createUris({
url: "/graphql",
fetchOptions: { headers: { "X-CSRF-Token": metaCSRFToken() } },
});React
import { UrisProvider, useUris } from "@uris-to/client/react";
<UrisProvider client={client}>
<App />
</UrisProvider>;useUris() returns the client from context, and throws outside a provider.
Subscriptions
import { cable } from "@uris-to/client/actioncable";Action Cable is an optional peer dependency, as is React. Install them only if you use them.
MIT.
