-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathObjectEventScope.njs
More file actions
43 lines (34 loc) · 1.08 KB
/
ObjectEventScope.njs
File metadata and controls
43 lines (34 loc) · 1.08 KB
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
37
38
39
40
41
42
43
import Nullstack from 'nullstack';
class NestedComponent extends Nullstack {
boolean = false
render({ source, onchange, id }) {
return (
<div>
<button source={source} onclick={onchange} id={id}>Inner: {this.boolean.toString()}</button>
</div>
)
}
}
class ObjectEventScope extends Nullstack {
boolean = false
visible = false
render() {
return (
<div data-hydrated={this.hydrated} data-boolean={this.boolean}>
<NestedComponent onchange={{boolean: true}} id="render-single-object" />
<NestedComponent onchange={[{ boolean: true }]} id="render-object-array" />
<p>----</p>
<button onclick={{visible: true}} id="rerender">show</button>
{this.visible &&
<div>
<NestedComponent onchange={{ boolean: true }} id="rerender-single-object" />
<NestedComponent onchange={[{ boolean: true }]} id="rerender-object-array" />
</div>
}
<p>----</p>
<p>Outter: {this.boolean.toString()}</p>
</div>
)
}
}
export default ObjectEventScope;