Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Created November 11, 2019 17:08
Show Gist options
  • Save apaleslimghost/c927ea10d5a986256753cab5da836527 to your computer and use it in GitHub Desktop.
Save apaleslimghost/c927ea10d5a986256753cab5da836527 to your computer and use it in GitHub Desktop.
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