supa-app
TypeScript icon, indicating that this package has built-in type declarations

0.0.22 • Public • Published

supa-app

A Supa Small Reactive View Library

Install

npm i supa-app

Counter App Demo

import { h, text, runApp } from 'supa-app';

const IncrementBy = amt => state => ({ 
  ...state, count: state.count + amt 
});

runApp({
  node: document.getElementById('app'),
  state: {
    count: 0
  },
  effects: state => [],
  subscriptions: state => [],
  view: (state, setState) => {
    return (
      h('main', {}, 
        h('output', {}, 
          text('Counter: '), text(state.count)
        ),
        h('div', {},
          h('button', { onclick: () => setState(IncrementBy(1)) }, text('+')),
          h('button', { onclick: () => setState(IncrementBy(-1)) }, text('-'))
        )
      )
    )
  }
});

Package Sidebar

Install

npm i supa-app

Weekly Downloads

1

Version

0.0.22

License

MIT

Unpacked Size

15.3 kB

Total Files

11

Last publish

Collaborators

  • rwbeast