# react-supabase

> React Hooks library for Supabase

Latest version **0.2.0** (published 2021-07-06) · MIT license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2021-07-06 |
| First published | 2021-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 24.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 343 |
| Maintainers | awkweb |

## Links

- npm: https://www.npmjs.com/package/react-supabase
- Repository: https://github.com/tmm/react-supabase
- Homepage: https://react-supabase.vercel.app/
- npm.io page: https://npm.io/package/react-supabase

## Recent versions

- 0.2.0 (latest) — 2021-07-06
- 0.1.10 — 2021-06-21
- 0.1.9 — 2021-05-31
- 0.1.8 — 2021-05-22
- 0.1.7 — 2021-05-17
- 0.1.6 — 2021-05-02
- 0.1.5 — 2021-05-02
- 0.1.4 — 2021-05-01
- 0.1.3 — 2021-04-29
- 0.1.2 — 2021-04-28
- 0.1.1 — 2021-04-27
- 0.1.0 — 2021-04-25

## README

## Introduction

`react-supabase` is a React Hooks library for [Supabase](https://supabase.io).

Visit the [docs site](https://react-supabase.vercel.app) for more info.

<br/>

## Installation

```
yarn add react-supabase @supabase/supabase-js
# or
npm install --save react-supabase @supabase/supabase-js
```

<br/>

## Quick Start

Create a Supabase client and pass it to the `Provider`:

```tsx
import { createClient } from '@supabase/supabase-js'
import { Provider } from 'react-supabase'

const client = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

const App = () => (
  <Provider value={client}>
    <YourRoutes />
  </Provider>
)
```

Now every component inside and under the `Provider` can use the Supabase client and hooks:

```tsx
import { useRealtime } from 'react-supabase'

const Todos = () => {
  const [result, reexecute] = useRealtime('todos')

  const { data, fetching, error } = result

  if (fetching) return <p>Loading...</p>
  if (error) return <p>Oh no... {error.message}</p>

  return (
    <ul>
      {data.map((todo) => (
        <li key={todo.id}>{todo.title}</li>
      ))}
    </ul>
  )
}
```

<br/>

## License

The MIT License.

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