return classNames({
'exp': this.state.clicked,
'noexp': !this.state.clicked
});
{this.getClassNames()} onClick={this.setState({clicked: !this.state.clicked})
class App extends React.Component {
state = {
classes: [ 'bullshit' ],
}
onFocus = () => {
this.setState(({ classes }) => ({
classes: [ ...classes, 'focus' ],
}));
}
onBlur = () => {
this.setState(({ classes }) => ({
classes: classes.filter(n => n !== 'focus'),
}));
}
render() {
return (
<div className={this.state.classes.join(' ')}>
<input onFocus={this.onFocus} onBlur={this.onBlur} />
</div>
);
}
}