0.4.0-rc.5 • Published 3 years ago

mobx-web-cell v0.4.0-rc.5

Weekly downloads
57
License
LGPL-3.0
Repository
-
Last release
3 years ago

MobX WebCell

MobX adaptor for WebCell v2

npm.io

NPM

Installation

npm install web-cell mobx@5 mobx-web-cell

Usage

source/model/index.ts

import { observable, action } from 'mobx';

class App {
    @observable
    count = 0;

    @action
    increase() {
        this.count++;
    }
}

export const app = new App();

Function Component

source/page/index.ts

import { createCell } from 'web-cell';
import { observer } from 'mobx-web-cell';

import { app } from '../model';

export default observer(function PageIndex() {
    return <div onClick={app.increase}>count: {app.count}</div>;
});

Class Component

source/page/index.ts

import { createCell, component, mixin } from 'web-cell';
import { observer } from 'mobx-web-cell';

import { app } from '../model';

@observer
@component({
    tagName: 'page-index'
})
export default class PageIndex extends mixin() {
    render() {
        return <div onClick={app.increase}>count: {app.count}</div>;
    }
}
0.4.0-rc.2

3 years ago

0.4.0-rc.1

3 years ago

0.4.0-rc.0

3 years ago

0.4.0-rc.5

3 years ago

0.4.0-rc.4

3 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.6

5 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago