A Cartoon intro to performance in React
160
-
Upload
lin-clark -
Category
Technology
-
view
24 -
download
0
Transcript of A Cartoon intro to performance in React
'
ReactDOM.render(<List />,
document.getElementById("app"))
'
'
'
shouldComponentUpdate(nextProps, nextState) { if (this.state.items === nextState.items) { return false } return true }
handleClick = () => { let nextItems = this.state.items;
// Calculate new values
this.setState({ items: nextItems }) }
shouldComponentUpdate(nextProps, nextState) { if (this.state.items === nextState.items) { return false } return true }
handleClick = () => { let nextItems = this.state.items;
nextItems.push(msg)
this.setState({ items: nextItems }) }