Skip to content

Instantly share code, notes, and snippets.

@stubailo
Created November 26, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stubailo/0d1ff3491c123d1d4be436c270d93aeb to your computer and use it in GitHub Desktop.
Save stubailo/0d1ff3491c123d1d4be436c270d93aeb to your computer and use it in GitHub Desktop.
A provider that lets you mock loading state
const LoadingProvider = (props) => {
const link = new ApolloLink((operation) => {
return new Observable(() => {});
});
const client = new ApolloClient({
link,
cache: new InMemoryCache(),
});
return (
<ApolloProvider client={client}>
{props.children}
</ApolloProvider>
);
};
@Adzz
Copy link

Adzz commented Mar 30, 2020

Where does Observable come from? Do you have to bring in RxJS just to get this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment