apprun-reactive
v0.1.0
Published
AppRun plugin that provides the @reactive decorator
Downloads
3
Readme
AppRun Reactive Plugin
Introduction
This plugin provides the @reactive decorator to make AppRun components reactive.
import { app, Component } from 'apprun';
import { reactive } from 'apprun-reactive';
@reactive
export default class Counter extends Component {
state = { num: 0 }
add = num => {
this.state.num = this.state.num + num;
}
view = state => <>
<div>{state.num}</div>
<button onclick={()=>this.add(-1)}>-1</button>
<button onclick={()=>this.add(+1)}>+1</button>
</>
}
new Counter().start(document.body);
Install
npm i apprun-reactive
- Use npm start to start the dev server
- Use npm test to run unit tests
- Use npm run build to build for production
Have fun and send pull requests.
License
MIT
Copyright (c) 2015-2019 Yiyi Sun