re: Let's Build Web Components! Part 7: Hybrids VIEW POST


Hybrids is pretty cool. What do you think about Haunted?


Hadn't heard of it 'till now, and had to do some googling to find it:

matthewp / haunted

React's Hooks API implemented for web components πŸ‘»

Haunted πŸ¦‡ πŸŽƒ

React's Hooks API but for standard web components and hyperHTML or lit-html.

<!doctype html&gt
<html lang="en"&gt
<script type="module">
  import { html } from '';
  import { component, useState } from '';

  function Counter() {
    const [count, setCount] = useState(0);

    return html`
      <div id="count">${count}</div>
      <button type="button" @click=${() => setCount(count + 1)}>Increment</button>

  customElements.define('my-counter', component(Counter));

Getting started

A starter app is available on codesandbox and also can be cloned from this repo. This app gives you the basics of how to…

Looks worth a glance, maybe I'll write a post on it.

Thanks for the tip!

code of conduct - report abuse