-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathChildComponent.tsx
More file actions
43 lines (36 loc) · 1.67 KB
/
ChildComponent.tsx
File metadata and controls
43 lines (36 loc) · 1.67 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 ParentComponent from './ParentComponent'
class ChildComponent extends ParentComponent {
static async getChildThis() {
return this.name
}
async initiate() {
this.parentThis = await this.getParentThis()
this.childThis = await this.getChildThis()
this.staticChildThis = await ChildComponent.getChildThis()
this.staticParentThis = await ParentComponent.getParentThis()
}
async hydrate() {
this.hydratedParentThis = await this.getParentThis()
this.hydratedChildThis = await this.getChildThis()
this.staticHydratedChildThis = await ChildComponent.getChildThis()
this.staticHydratedParentThis = await ParentComponent.getParentThis()
this.bunda = 'true'
}
renderInnerComponent() {
return (
<div>
<div data-current="ChildComponent" />
<div data-parent-this={this.parentThis === this.constructor.name} />
<div data-child-this={this.childThis === this.constructor.name} />
<div data-hydrated-parent-this={this.hydratedParentThis === this.constructor.name} />
<div data-hydrated-child-this={this.hydratedChildThis === this.constructor.name} />
<div data-static-child-this={this.staticChildThis === this.constructor.name} />
<div data-static-parent-this={this.staticParentThis === ParentComponent.name} />
<div data-static-hydrated-child-this={this.staticHydratedChildThis === this.constructor.name} />
<div data-static-hydrated-parent-this={this.staticHydratedParentThis === ParentComponent.name} />
{this.constructor.name} {this.hydratedParentThis} {String(this.hydratedParentThis === this.constructor.name)}
</div>
)
}
}
export default ChildComponent