This package has been deprecated

Author message:

WARNING: Not recommended to use

fluxive

0.0.16 • Public • Published

Fluxive

Flux-like MVB(MVVM) Library

Installation

npm install fluxive

Difference between Fluxive and Flux

Flux defines data flow as:

Action → Dispatcher → Store → View → Action → ...

But, Fluxive defines data flow as:

        (Model)
           ↓
Action → Binder → View → Action → ...

Notice:

  • Binder is Dispacher, and also Store in Flux.
  • Model is maybe unnecessary, but if you feel data store becoming more complex, you can use Model to solve its complexity.

Simple example

Create Action

let fooAction = Fluxive.Action(input => {
  let output = /* some code */;
  return output;
});

Create Binder

class FooBinder extends Fluxive.Binder {
  constructor() {
    super();
    this.state = {
      fooInfo: 'initial foo'
    };
    this.on(fooAction, output => {
      this.setState({fooInfo: output});
    });
  }
}

Create View

class FooHandler extends Fluxive.Component {
  constructor(props) {
    super(props);
    this.involve(FooBinder);
  }
  render() {
    let {binder} = this;
    return (
      <p>Foo info: {binder.get('fooInfo')}</p>
    );
  }
}

More details

Preparing

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i fluxive

Weekly Downloads

0

Version

0.0.16

License

MIT

Last publish

Collaborators

  • mozisan