Files
excel-download/react_webgame/main/RenderTest.jsx

35 lines
756 B
JavaScript

import React, { PureComponent } from 'react';
class Test extends PureComponent {
state = {
counter: 0,
string: 'hello',
number: 1,
boolean: true,
object: {},
array: [],
};
// shouldComponentUpdate(nextProps, nextState, nextContext) {
// if(this.state.counter !== nextState.counter) {
// return true;
// }
// return false;
// }
onClick = () => {
this.setState({
array: [...this.state.array, 1],
});
}
render() {
console.log('렌더링', this.state);
return (
<div>
<button onClick={this.onClick}>클릭</button>
</div>
)
}
}
export default Test;