Skip to content

Instantly share code, notes, and snippets.

@zouhir
Last active March 26, 2018 09:39
Show Gist options
  • Save zouhir/33e1929441b4a2301cd6f7cf34974c91 to your computer and use it in GitHub Desktop.
Save zouhir/33e1929441b4a2301cd6f7cf34974c91 to your computer and use it in GitHub Desktop.
import { h, render, Component } from "preact";
class HelloWidget extends Component {
render() {
let time = new Date().toLocaleTimeString();
let name = this.props.name || "nobody";
return <h1>{`Hello ${name}, time is: ${time}`}</h1>;
}
}
// render an instance of Widget into <body>:
render(<HelloWidget />, document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment