以下代码是我要计算的VDOM与DOM,但是两次事件单击都显示相同的时序,请让我知道在寻找不同的性能时序时遗漏了什么。 ..?
`class App extends Component {
constructor() {
super();
this.state = {
name: 'React'
};
}
handle = () =>
{
this.setState({name:'Sample'});
}
handleDOM = () =>
{
document.getElementById('lblName').innerHTML='Test';
this.setState({name:'Sample'});
}render() {
return (
<div>
<input type="button" value="V-Dom Click timings" onClick={this.handle}/>
<br/>
<label>{this.state.name}</label>
<input type="button" value="Dom Click timings" onClick=
{this.handleDOM}/>
<br/>
<label id='lblName'></label>
</div>
);
}
}render(<App />, document.getElementById('root'));`