0.2.3 • Published 7 years ago

react-mlux-binder v0.2.3

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

react-mlux-binder

基于mlux,用于实现在react或者react-native框架下组件自动监听store变化并更新。

Features

  • 在监听的store数据发生变化时动态更新视图。
  • 提供多种方法方便创建Binder组件。

Demo

请移步Lottery项目;

Usage

在项目根目录下执行

npm install react-mlux-binder --save

在项目文件中引入

import Binder from 'react-mlux-binder';

API Reference

//当testStore的值发生改变的时,Text组件中的内容将会自动更新。
<Binder bind = {[testStore]} render = {()=><Text>{testStore.value}</Text>}}/>

Binder.createClass

createClass方法将一个普通的Component变成一个Binder Component。

Binder.createClass(ReactComponent:Class<React.Component<*,*,*>>):Class<*>
let BinderA = Binder.createClass(A);

<BinderA bind = {[store]} propsUpdater = {()=>{
    name:store.name
}} />
0.2.3

7 years ago

0.2.1

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago