Minimal functional application creator. A demonstration of basic functional UI principles.
npm install microappMinimal functional application creator.
A demonstration of basic functional UI principles.
``sh`
npm i microapp
`js
import createApp, { h } from 'microapp'
// Redux-like reducer for application state
const reducer = (state = {
count: 0
}, action) => {
switch (action.type) {
case: 'dec':
const count = state.count - 1
return { ...state, count }
case: 'inc':
const count = state.count + 1
return { ...state, count }
default:
return state
}
}
// Functional UI component
const App = ({ state, dispatch }) => {
return h
}const app = createApp(reducer, App)
app.mount(document.body)
``