Last active
August 29, 2015 14:08
-
-
Save leebyron/272a37e963978ba77a6c 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
function handleClick(element, event) { | |
if (event.button === 1) { | |
return { count: 0 }; | |
} | |
if (element.props.onClick) { | |
element.onClick(); | |
} | |
element.updateState(s => {...s, count: s.count + 1 }); | |
} | |
export function render(element) { | |
return ( | |
<div> | |
Clicked {element.state.count} times | |
<button onClick={handleClick} style={{ width: element.props.width }} /> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment