draqula

? GraphQL client for minimalistic React apps

  • Owner: vadimdemedes/draqula
  • Platform:
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

$ 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

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 (
		<div>
			{isLoading && <span>Loading…</span>}
			{error && <span>Error: {error.message}</span>}
			{data && (
				<ul>
					{data.todos.map(todo => (
						<li key={todo.id}>{todo.title}</li>
					))}
				</ul>
			)}
		</div>
	);
};

const client = new Draqula('https://my-graphql-api.com/graphql');

render(
	<DraqulaProvider client={client}>
		<Todos />
	</DraqulaProvider>,
	document.body
);

Documentation

Docs can be found at https://draqulajs.com

Main metrics

Overview
Name With Ownervadimdemedes/draqula
Primary LanguageJavaScript
Program languageTypeScript (Language Count: 2)
Platform
License:
所有者活动
Created At2019-08-25 01:39:40
Pushed At2020-04-04 06:58:44
Last Commit At2020-04-04 09:57:59
Release Count15
Last Release Namev0.5.4 (Posted on 2020-04-04 09:58:00)
First Release Namev0.1.0 (Posted on 2019-09-02 22:40:08)
用户参与
Stargazers Count768
Watchers Count9
Fork Count13
Commits Count73
Has Issues Enabled
Issues Count19
Issue Open Count6
Pull Requests Count6
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private