Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mintsweet/reate
:fire: A lightweight react global state management library
https://github.com/mintsweet/reate
Last synced: about 2 months ago
JSON representation
:fire: A lightweight react global state management library
- Host: GitHub
- URL: https://github.com/mintsweet/reate
- Owner: mintsweet
- License: mit
- Created: 2021-06-30T07:19:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-01T08:01:46.000Z (over 3 years ago)
- Last Synced: 2024-11-01T08:50:23.943Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 49.8 KB
- Stars: 18
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Reate
> A lightweight react global state management library.
## ✨ Feature
- Simple and easy to use, only three APIs.
- Only 4kb size after build.
- Support TypeScript static check.
- No dependencies.## 🌈 Install
```bash
$ npm i reate --save
```## 😊 Usage
**create a store**
```javascript
// store.js
import Reate from 'reate';export default new Reate(
{
visible: false,
},
{
changeVisible: (store, { visible }) => store.setState({ visible });
}
);
```**use this store in react**
```javascript
// Test.js
import React from 'react';
import store from './store.js';function Test() {
const visible = store.useState('visible');
return (
store.dispatch('changeVisible', { visible: !visible })}
>
ChangeVisible
{visible ?Hide:Show}
);
}
```## 🔨 License
[MIT](LICENSE)