Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lxsmnsyc/riptide

An experimental state management library. Write Observables like you write React Hooks
https://github.com/lxsmnsyc/riptide

observable react-hooks state-management

Last synced: 14 days ago
JSON representation

An experimental state management library. Write Observables like you write React Hooks

Awesome Lists containing this project

README

        

# riptide

> An experimental state management library. Write Observables like you write React hooks.

## Install

yarn

```bash
yarn add @lxsmnsyc/riptide
```

npm

```bash
npm install @lxsmnsyc/riptide
```

## Example

```ts
import riptide from '@lxsmnsyc/riptide';

const counter = riptide.createColdRiptide(() => {
const [state, setState] = riptide.useState(0);

if (state > 10) {
return riptide.complete();
}

setState(state + 1);

return riptide.next(state);
});

counter.subscribe({
next(value) {
console.log(`Received: ${value}`);
},
error(value) {
console.log(value);
},
complete() {
console.log(`Counter completed!`);
},
});
```

## License

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