# react-compostate

> Compostate bindings for React

Latest version **0.6.0-alpha.1** (published 2023-02-26) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.6.0-alpha.1 |
| Published | 2023-02-26 |
| First published | 2021-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 39.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Alexis Munsayac |
| Maintainers | lxsmnsyc |
| Keywords | pridepack |

## Links

- npm: https://www.npmjs.com/package/react-compostate
- Repository: https://github.com/lxsmnsyc/compostate
- Issues: https://github.com/lxsmnsyc/compostate/issues
- npm.io page: https://npm.io/package/react-compostate

## Dependencies (1)

- [@lyonph/react-hooks](https://npm.io/package/@lyonph/react-hooks.md) ^0.6.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.6.0-alpha.1 (latest) — 2023-02-26
- 0.6.0-alpha.0 — 2023-02-26
- 0.5.1 — 2023-02-25
- 0.5.0 — 2022-09-16
- 0.4.0 — 2022-06-08
- 0.3.0 — 2022-05-22
- 0.2.1-beta.10 — 2021-09-09
- 0.2.1-beta.9 — 2021-09-09
- 0.2.1-beta.8 — 2021-09-08
- 0.2.1-beta.6 — 2021-08-29
- 0.2.1-beta.5 — 2021-08-29
- 0.2.1-beta.4 — 2021-08-28
- 0.2.1-beta.3 — 2021-08-28
- 0.2.1-beta.2 — 2021-08-28
- 0.2.1-beta.1 — 2021-08-26
- … 52 more at https://npm.io/package/react-compostate/versions

## README

# react-compostate

> React bindings for [compostate](https://github.com/lxsmnsyc/compostate/tree/main/packages/compostate)

[![NPM](https://img.shields.io/npm/v/react-compostate.svg)](https://www.npmjs.com/package/react-compostate) [![JavaScript Style Guide](https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)

## Install

```bash
npm install --save compostate react-compostate
```

```bash
yarn add compostate react-compostate
```

```bash
pnpm add compostate react-compostate
```

## Usage

```js
import { defineComponent, onEffect } from 'react-compostate';
import { ref } from 'compostate';

// Define a component
const CounterMessage = defineComponent((props) => {
  // This function only runs once, hooks cannot be used here.

  // react-compostate provides `onEffect` as a lifecycle hook
  // You can use this instead of tracking API like `effect`
  onEffect(() => {
    console.log('Count: ', props.value);
  });

  // Return the render atom
  return () => (
    <h1>{`Count: ${props.value}`}</h1>
  );
});

const Counter = defineComponent(() => {
  const count = ref(0);

  function increment() {
    count.value += 1;
  }

  function decrement() {
    count.value -= 1;
  }

  return () => (
    <>
      <button type="button" onClick={increment}>
        Increment
      </button>
      <button type="button" onClick={decrement}>
        Decrement
      </button>
      <CounterMessage value={count.value} />
    </>
  );
});
```

## License

MIT © [lxsmnsyc](https://github.com/lxsmnsyc)

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