summaryrefslogtreecommitdiff
path: root/App.js
blob: ebfcae3cea6e14dfe7ca152d4209dacbc32c9232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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}
         ),
      ]
   );
}