From 4340442e5d4791298d62e2d3236a9341ca9c7b0c Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 21 Jan 2019 17:15:36 -0500 Subject: [PATCH] Add initial dot-dom --- public/index.html | 2 ++ public/script.js | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 public/script.js diff --git a/public/index.html b/public/index.html index 9092821..0f3e8c2 100644 --- a/public/index.html +++ b/public/index.html @@ -63,6 +63,8 @@ + + \ No newline at end of file diff --git a/public/script.js b/public/script.js new file mode 100644 index 0000000..3db4d42 --- /dev/null +++ b/public/script.js @@ -0,0 +1,26 @@ +function Hello(props) { + return H('div', `Hello ${props.toWhat}`); +} + +function FinalImage(props) { + return H('img', { src: props.src }); +} + +function Dropdown(props) { + return H('select', { className: 'dropdown' }, + props.options.map(o => H('option', o)) + ); +} + +function Clickable(props, state, setState) { + const { clicks = 0 } = state; + + return H('button', + { + onclick() { + setState({ clicks: clicks + 1 }) + } + }, + `Clicked ${clicks} times` + ); +} \ No newline at end of file