Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vadimdemedes/draqula
π§ GraphQL client for minimalistic React apps
https://github.com/vadimdemedes/draqula
Last synced: 9 days ago
JSON representation
π§ GraphQL client for minimalistic React apps
- Host: GitHub
- URL: https://github.com/vadimdemedes/draqula
- Owner: vadimdemedes
- Archived: true
- Created: 2019-08-25T01:39:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-04T06:58:44.000Z (over 4 years ago)
- Last Synced: 2024-04-15T12:13:34.705Z (7 months ago)
- Language: JavaScript
- Homepage: https://draqulajs.com
- Size: 603 KB
- Stars: 772
- Watchers: 11
- Forks: 15
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Draqula is a GraphQL client for React apps that don't need everything.
Instead of offering tons of features like extensive caching mechanism, local state management, subscriptions and so on, Draqula focuses on executing the basics well - queries and mutations.If you want to take a quick look, keep scrolling this readme.
Otherwise, check out the documentation at https://draqulajs.com.## Install
```console
$ npm install draqula graphql graphql-tag
```## Features
- Simple API and codebase
- Basic cache implementation with aggressive invalidation and refetching
- Automatic retries of network/timeout errors and GraphQL queries
- Straightforward way to hook into requests without a need for middleware
- Refetches queries when window gets focused## Usage
```jsx
import React from 'react';
import {render} from 'react-dom';
import {Draqula, DraqulaProvider, useQuery} from 'draqula';
import gql from 'graphql-tag';const TODOS_QUERY = gql`
query {
todos {
id
title
}
}
`;const Todos = () => {
const {data, isLoading, error} = useQuery(TODOS_QUERY);return (
{isLoading && Loadingβ¦}
{error && Error: {error.message}}
{data && (
{data.todos.map(todo => (
- {todo.title}
))}
)}
);
};const client = new Draqula('https://my-graphql-api.com/graphql');
render(
,
document.body
);
```## Documentation
Docs can be found at https://draqulajs.com