Skip to content

Instantly share code, notes, and snippets.

@chrisdmacrae
Last active July 9, 2020 22:02
Show Gist options
  • Save chrisdmacrae/e4abb675b2daae6738ef7df643b7a013 to your computer and use it in GitHub Desktop.
Save chrisdmacrae/e4abb675b2daae6738ef7df643b7a013 to your computer and use it in GitHub Desktop.
Functional stencil dream
‪@Component({ tag: “falcon-punch” })‬
‪export function FalconPunch(props) {‬
‪ @state() let hasPunched: Boolean = false;‬
const doPunch = () => hasPunched = true;
‪ @onChange(hasPunched)‬
‪ function handleHasPunchChange() {‬
‪ if (hasPunched)‬
‪ alert(`React just got punched!`)‬
‪ }‬
‪ return (‬
‪ <button onClick={doPunch} type=“button”>Punch</button>‬
‪ )‬
‪}‬
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment