# react-adaka

> High-precision state management for React using adaka

Latest version **0.1.0** (published 2024-11-29) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2024-11-29 |
| First published | 2023-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Francis Asante |
| Maintainers | kofrasa |
| Keywords | state, query, project, immutable, observable, react |

## Links

- npm: https://www.npmjs.com/package/react-adaka
- Repository: https://github.com/kofrasa/react-adaka
- Homepage: https://github.com/kofrasa/react-adaka#readme
- Issues: https://github.com/kofrasa/react-adaka/issues
- npm.io page: https://npm.io/package/react-adaka

## Dependencies (2)

- [adaka](https://npm.io/package/adaka.md) 0.1.0
- [use-sync-external-store](https://npm.io/package/use-sync-external-store.md) ^1.2.0

## 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

- 0.1.0 (latest) — 2024-11-29
- 0.0.11 — 2024-03-23
- 0.0.10 — 2024-03-04
- 0.0.9 — 2024-02-29
- 0.0.5 — 2024-02-27
- 0.0.4 — 2023-09-26
- 0.0.3 — 2023-06-28
- 0.0.2 — 2023-06-26
- 0.0.1 — 2023-06-08
- 0.0.0 — 2023-06-04

## README

# react-adaka

High-precision state management for React using [adaka](https://npmjs.com/package/adaka).

![license](https://img.shields.io/github/license/kofrasa/react-adaka)
[![version](https://img.shields.io/npm/v/react-adaka)](https://www.npmjs.org/package/react-adaka)
[![build](https://github.com/kofrasa/react-adaka/actions/workflows/build.yml/badge.svg)](https://github.com/kofrasa/react-adaka/actions/workflows/build.yml)
![issues](https://img.shields.io/github/issues/kofrasa/react-adaka)
[![codecov](https://img.shields.io/codecov/c/github/kofrasa/react-adaka)](https://codecov.io/gh/kofrasa/react-adaka)
[![npm downloads](https://img.shields.io/npm/dm/react-adaka)](https://www.npmjs.org/package/react-adaka)

## Install

`npm i react-adaka`

## Usage

Define your store and selector.

```ts
// store.ts
import { createStore, createSelectorHook } from "react-adaka";

// first create your store
export const store = createStore({
  status: "error",
  errors: [{ type: "api", message: "unknown error" }]
});

// create a selector hook. need only per store.
export const useSelector = createSelectorHook(store);
```

Now use the selector.

```ts
// component.ts
import { useSelector } from "./store";

// use the hook inside your React component.
function ShowErrorTypes() {
  // select the types of errors only when the status is in "error".
  const { errorTypes } = useSelector(
    { errorTypes: "$errors.type" },
    { status: "error" }
  );

  return errorTypes ? (
    <div>Issues found: {errorTypes.join("\n")} </div>
  ) : (
    <div />
  );
}

export default ShowErrorTypes;
```

## License

MIT

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