And if you want to get a little further
import {render, html} from 'uhtml'; const Header = () => html`<h1>Header</h1>` const Footer = () => html`<h1>Footer</h1>` const Counter = (state, actions) => html` <h1>${state.counter}</h1> <button class="counter" onclick=${actions.inc}>INC</button> <input value = "not erased"/>` const App = (function () { const State = { counter : 0 } const Actions = { inc : () => { State.counter += 1; redraw(); } } function view (s, a) { return html` ${Header()} ${Counter(s, a)} ${Footer()} ` } function redraw () { render(app, view(State, Actions)) } return { redraw } })() App.redraw()
You can test it here IntroSamPattern
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
And if you want to get a little further
You can test it here IntroSamPattern