DEV Community

Cover image for µHTML
artydev
artydev

Posted on

µHTML

Andrea makes part to a certain type of developpers, those who innove and create constantly.
Very few are as productive as him in frontend developpement.
I absolutetly don't know him personnaly, but I am very impressed by his work.

Look at his site on WebReflection

Here a sample code from one of his numerous libraries µhtml
See how you can 'render' in 'render' !!!

You can see it in action here : µhtml

import {html, render} from "uhtml"

const Button = selector => {
  const button = document.querySelector(selector);
  return count => render(button, html`
    Clicks: ${count}
  `);
};

const Clicker = selector => {
  const button = Button(selector);
  return function update(count) {
    return render(document.body, html`
      <input style="width:200px" value="default value"/>
      <div onclick=${() => update(++count)}>
        Click again:
        ${button(count)}
      </div>
    `);
  };
}

Clicker('#btn-clicker')(100);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)