Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Created May 21, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbranyen/a8df8fa587b45e4a9da2be452f2a1f25 to your computer and use it in GitHub Desktop.
Save tbranyen/a8df8fa587b45e4a9da2be452f2a1f25 to your computer and use it in GitHub Desktop.
Web Component using JSX Demo
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!" />);
@tbranyen
Copy link
Author

tbranyen commented May 21, 2017

Output:

out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment