Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/lxsmnsyc/riptide
- Owner: lxsmnsyc
- License: mit
- Created: 2020-07-08T02:41:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T01:53:57.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T14:03:32.519Z (2 months ago)
- Topics: observable, react-hooks, state-management
- Language: TypeScript
- Homepage:
- Size: 2.36 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)