Created
November 11, 2019 17:08
-
-
Save apaleslimghost/c927ea10d5a986256753cab5da836527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { render, useState, html } from 'excise' | |
// props is attributes | |
const Counter = ({initialCount = 0}) => { | |
const [count, setCount] = useState(initialCount) | |
return html` | |
<button onClick=${() => setCount(count + 1)}>+</button> | |
${count} | |
` | |
} | |
// using Counter in markup is enough to register the component | |
render(html`<${Counter} initialCount=${5} />`, document.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment