Created
May 21, 2017 17:17
-
-
Save tbranyen/a8df8fa587b45e4a9da2be452f2a1f25 to your computer and use it in GitHub Desktop.
Web Component using JSX Demo
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 { innerHTML, createTree } from 'diffhtml'; | |
import WebComponent from 'diffhtml-components/web-component'; | |
import PropTypes from 'proptypes'; | |
customElements.define('jsx-test', class extends WebComponent { | |
render({ message }) { | |
return ( | |
<div>{message}</div> | |
); | |
} | |
static propTypes = { | |
message: PropTypes.string.isRequired, | |
} | |
}); | |
innerHTML(document.body, <jsx-test message="Hello world!" />); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: