Skip to content

Instantly share code, notes, and snippets.

@tbranyen tbranyen/diffhtml.js
Last active Apr 24, 2019

Embed
What would you like to do?
diffHTML "Calculator" Experiment
import { innerHTML, html } from 'https://unpkg.com/diffhtml/dist/es';
let a = 1;
let b = 2;
const updateA = ({ target }) => (a = Number(target.value), render());
const updateB = ({ target }) => (b = Number(target.value), render());
function render() {
innerHTML(document.body, html`
<input type="number" value=${a} onInput=${updateA}>
<input type="number" value=${b} onInput=${updateB}>
<p>${a} + ${b} = ${a + b}</p>
`);
}
render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.