Skip to content

hyperapp's counter app built using jsx in typescript and bundled with parcel.js

Notifications You must be signed in to change notification settings

attack-monkey/hyperapp-count-ts-jsx-parcel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyperapp - Counter App (typescript / parcel / jsx)

Hyperapp's counter app modularised and typed using parcel.js (bundler) and typescript.

Install

Install parcel.js globally (This is the bundler)


npm install -g parcel-bundler

Install dependencies


npm install

Start


npm start

Immutable Update

This app uses iu-ts (immutable update - typescript) to immutably update deep nested objects.

Declarative actions are still recommended, however using iu-ts removes the need to nest actions (allowing for easier refactor).

eg.

// The following immutably increments state.counter.count using iu

<button onclick={() => actions.counterUp(1))}>-</button>
export const actions: Actions = {
    counterUp: value => state => iu(state, 'counter/count', state.counter.count + value),
    counterDown: value => state => iu(state, 'counter/count', state.counter.count - value)
}

Dir Structure


- index.html
- index.tsx
- src
    - actions
    - components
        - main (entry component)
            - main.component.tsx
            - *Next component down - etc.*
        - shared (shared components)
    - state
    - utils

About

hyperapp's counter app built using jsx in typescript and bundled with parcel.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published