I have to change(add) className on the first div, after click on "icon-caret-down". My code doesn't work. Can you give me some tips?
export default class Nav extends React.Component {
render() {
var btnClass = classNames({
'nav-conteiner': true,
'nav-conteiner-mob': this.state.isPressed
});
return (
<div classNames={btnClass}>
<span className='icon-soundcloud'></span>
<h6 id="site-name">SoundCloud</h6>
<span className="icon-caret-down" onClick={this.openSerch.bind(this)}></span>
<ul>
<li><a href='#'>Explore</a></li>
<li><a href='#'>Playlist</a></li>
</ul>
<Search/>
</div>
);
}
openSerch(){
console.log('hello');
this.setState({isPressed:true});
}
}
<div classNames=-><div className=will already help.var btnClass = classnames({ 'nav-conteiner': true, 'nav-conteiner-mob': this.state.isPressed });with a lower caseninclassnamesand the correction that @JulienD suggested