summaryrefslogtreecommitdiff
path: root/App.js
diff options
context:
space:
mode:
Diffstat (limited to 'App.js')
-rw-r--r--App.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/App.js b/App.js
new file mode 100644
index 0000000..ebfcae3
--- /dev/null
+++ b/App.js
@@ -0,0 +1,36 @@
+let state = {};
+let internalState = {};
+
+state.currentChar = '你';
+
+function setState(key, value)
+{
+ state[key] = value;
+ render();
+}
+
+
+const CurrentCharacter = function({character})
+{
+ return h(
+ 'h1',
+ { onClick: () => setState('currentChar', '我') },
+ character
+ );
+}
+
+
+const App = function()
+{
+ const { currentChar } = state;
+
+ return h(
+ 'div', {},
+ [
+ h(
+ CurrentCharacter,
+ {character: currentChar}
+ ),
+ ]
+ );
+}