# react-cell

> Inspired by [Redwood Cells](https://redwoodjs.com/tutorial/cells), using Apollo Client.

Latest version **0.0.5** (published 2020-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-cell
pnpm add react-cell
yarn add react-cell
bun add react-cell
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2020-09-07 |
| First published | 2020-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Randomness |
| Maintainers | randomness |

## Links

- npm: https://www.npmjs.com/package/react-cell
- npm.io page: https://npm.io/package/react-cell

## Recent versions

- 0.0.5 (latest) — 2020-09-07
- 0.0.4 — 2020-09-07
- 0.0.3 — 2020-09-07
- 0.0.2 — 2020-09-07
- 0.0.1 — 2020-09-07

## README

# react-cell

Inspired by [Redwood Cells](https://redwoodjs.com/tutorial/cells), using Apollo Client.

## Getting started

```
yarn add react-cell
```

## Features

- First-class TypeScript support

## Usage

```tsx
import cell from 'react-cell';
import { gql } from '@apollo/client';

interface NovelCellProps {
  title: string;
}

const QUERY = gql`
query($title: String) {
  novel(title: $title) {
    title
    description
  }
}`;

const NovelCell = cell<{ novel: Novel }, NovelCellProps>(QUERY, {
  Success({ novel: Novel }) {
    return (
      <div>
        <h1>{novel.title}</h1>
        <h1>{novel.description}</h1>
      </div>
    );
  },

  Loading() {
    return (
      <div>Loading...</div>
    ); 
  },

  Empty() {
    return (
      <div>Found nothing.</div>
    ); 
  },

  Failure({ error }) {
    return (
      <div>Error: {error.message}</div>
    ); 
  }
});

<NovelCell title="Title here">
```

---
_Source: https://npm.io/package/react-cell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
