# feathers-react-hooks

> react hooks for use with feathersjs

Latest version **1.1.1** (published 2019-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install feathers-react-hooks
pnpm add feathers-react-hooks
yarn add feathers-react-hooks
bun add feathers-react-hooks
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-08-14 |
| First published | 2019-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 12.8.0 |
| Dependencies | 0 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | saiichihashimoto |
| Keywords | feathers, feathersjs, hook, react |

## Links

- npm: https://www.npmjs.com/package/feathers-react-hooks
- Repository: https://github.com/saiichihashimoto/feathers-react-hooks
- Homepage: https://saiichihashimoto.github.io/feathers-react-hooks/
- Issues: https://github.com/saiichihashimoto/feathers-react-hooks/issues
- npm.io page: https://npm.io/package/feathers-react-hooks

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2019-08-14
- 1.1.0 — 2019-08-12
- 1.0.0 — 2019-08-12

## README

[![current version](https://img.shields.io/npm/v/feathers-react-hooks.svg)](https://www.npmjs.com/package/feathers-react-hooks)
[![Build Status](https://travis-ci.org/saiichihashimoto/feathers-react-hooks.svg?branch=master)](https://travis-ci.org/saiichihashimoto/feathers-react-hooks)
[![Coverage Status](https://coveralls.io/repos/github/saiichihashimoto/feathers-react-hooks/badge.svg?branch=master)](https://coveralls.io/github/saiichihashimoto/feathers-react-hooks?branch=master)
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/saiichihashimoto/feather-react-hooks/master)](https://stryker-mutator.github.io)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Greenkeeper badge](https://badges.greenkeeper.io/saiichihashimoto/feathers-react-hooks.svg)](https://greenkeeper.io/)

React hooks for use with [feathersjs](https://feathersjs.com).

# Install

```bash
npm install --save feathers-react-hooks
```

# Hooks

- [`useAuthentication`](#useauthentication) &mdash; tracks authentication status. _calls [`app.authenticate()`](https://docs.feathersjs.com/api/authentication/client.html#appauthenticate)_
- [`useSetting`](#useauthentication) &mdash; tracks an application setting.

## useAuthentication

Tracks authentication status. _Calls [`app.authenticate()`](https://docs.feathersjs.com/api/authentication/client.html#appauthenticate)_.

```js
import { useAuthentication } from 'feathers-react-hooks';

export default function YourReactComponent() {
  const isAuthenticated = useAuthentication(app);

  if (isAuthenticated === null) {
    return 'authenticating...';
  }

  return isAuthenticated
    ? 'authenticated!'
    : 'not authenticated';
}
```

## useSetting

Tracks an application setting.

```js
import { useSetting } from 'feathers-react-hooks';

export default function YourReactComponent() {
  const [value, setValue] = useSetting(app, 'setting_name', 'default value');

  return (
    <button type="button" onClick={() => setValue('new value')}>
      {value}
    </button>
  );
}
```

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