3 ms·
You shouldn't be accessing the DOM unless you absolutely need it (e.g. get clientHeight on a node). Use state instead: _handleClick: function() { this.
by underwater 13y ago
You shouldn't be accessing the DOM unless you absolutely need it (e.g. get clientHeight on a node). Use state instead:
_handleClick: function() {
this.setState({expanded: true});
},
render: function() {
return (
<div className={this.state.expanded ? 'expanded' : 'compact'}>
<button onClick={this._handleClick} />
</div>
);
}