@spear-ai/relay-environment
v1.0.5
Published
Spear AI Relay Environment
Downloads
13
Readme
@spear-ai/relay-environment
General purpose Relay Environment.
Installation
yarn add relay-runtime @spear-ai/relay-environment
Usage
Add the following to your React Relay Provider:
import { createEnvironment } from "@spear-ai/relay-environment";
import React, { useMemo } from "react";
import { RelayEnvironmentProvider } from "react-relay";
const apiUrl = "/api/graphql";
const environment = createEnvironment({ apiUrl });
export const RelayProvider = (properties: { children: JSX.Element }) => {
const { children } = properties;
return <RelayEnvironmentProvider environment={environment}>{children}</RelayEnvironmentProvider>;
};