apprun-reactive

0.1.0 • Public • Published

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

/apprun-reactive/

    Package Sidebar

    Install

    npm i apprun-reactive

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    152 kB

    Total Files

    14

    Last publish

    Collaborators

    • yysun