Skip to content

Commit

Permalink
update 170906 18:41
Browse files Browse the repository at this point in the history
  • Loading branch information
SPxiaomin committed Sep 6, 2017
1 parent 16e6d95 commit a3f29c0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Empty file.
27 changes: 25 additions & 2 deletions react-performance-improve/src/TestOne/component/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class App extends Component {

this.differentType = this.differentType.bind(this);
this.listWithoutKey = this.listWithoutKey.bind(this);
this.differentAttr = this.differentAttr.bind(this);
}

changeShape() {
Expand Down Expand Up @@ -54,11 +55,26 @@ class App extends Component {
if (this.state.shape) {
return (
<div>
{/* TODO: stop writing here */}
<A key='a' />
<B key='b' />
</div>
);
} else {
return (
<div>
<A key='a' />
<C key='c' />
<B key='b' />
</div>
);
}
}

differentAttr() {
if (this.state.shape) {
return <A name='before' />;
} else {
return <A name='after' />;
}
}

Expand All @@ -69,7 +85,14 @@ class App extends Component {
{
this.differentType()
} */}
<button onClick={this.changeShape}>Change List</button>
{/* <button onClick={this.changeShape}>Change List</button>
{
this.listWithoutKey()
} */}
<button onClick={this.changeShape}>Change Attr</button>
{
this.differentAttr()
}
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion react-performance-improve/src/TestOne/component/B/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class B extends Component {
console.log('B componentDidUpdate');
}

componentWilUnmount() {
componentWillUnmount() {
console.log('B componentWillUnmount');
}

Expand Down

0 comments on commit a3f29c0

Please sign in to comment.