0.4.0-rc.5 • Published 2 years ago

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

Weekly downloads
57
License
LGPL-3.0
Repository
-
Last release
2 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

2 years ago

0.4.0-rc.1

2 years ago

0.4.0-rc.0

2 years ago

0.4.0-rc.5

2 years ago

0.4.0-rc.4

2 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago