Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bbxjs/bbx
𝕓𝕓𝕩 是一个极其简单高效的 React 状态管理方式
https://github.com/bbxjs/bbx
react state
Last synced: about 1 month ago
JSON representation
𝕓𝕓𝕩 是一个极其简单高效的 React 状态管理方式
- Host: GitHub
- URL: https://github.com/bbxjs/bbx
- Owner: bbxjs
- Created: 2018-08-08T07:10:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T13:48:12.000Z (over 6 years ago)
- Last Synced: 2024-10-14T13:37:42.648Z (about 2 months ago)
- Topics: react, state
- Language: JavaScript
- Homepage: https://bbxjs.github.io/
- Size: 81.1 KB
- Stars: 132
- Watchers: 9
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-star-libs - bbxjs / bbx
README
## bbx
[![npm](https://img.shields.io/npm/v/bbx.svg)](https://www.npmjs.com/package/bbx)
[![travis](https://img.shields.io/travis/bbxjs/bbx.svg)](https://travis-ci.org/bbxjs/bbx)
[![Coverage Status](https://coveralls.io/repos/github/bbxjs/bbx/badge.svg)](https://coveralls.io/github/bbxjs/bbx)
![David](https://img.shields.io/david/bbxjs/bbx.svg)𝕓𝕓𝕩 是一个极其简单高效的 React 状态管理方式
开始使用:[https://bbxjs.github.io/start/](https://bbxjs.github.io/start/)
### 特点
- **超简单:baby:**: 了解 api 几乎没成本,会用 React 即会用 bbx,或许你已经会用了
- **清晰:sun_with_face:**: 状态管理清清楚楚,方法调用也直观明了
- **扩展性:hatching_chick:**: bbx 内置了许多项目开发中常用的方法,当然你也能很方便的开发更多的方法#### 使用
```
$ npm install bbx
```1. 定义一个状态类
```jsx
import { State } from 'bbx';class Hello extends State {
state = { say: 'hello 👶' }
hi() { this.setState({ say: 'hi !' }) }
}
```2. 实例化这个类
```jsx
const hello = new Hello();
```3. 连接这个实例到 React 组件
```jsx
import { connect } from 'bbx';@connect(hello)
class App extends React.Component {
render() {
return
{hello.state.say}
hello.hi()}>hi
}
}
```[在线查看可运行的代码](https://stackblitz.com/edit/bbx-example-hello)