Drop Down을 구현하려고 찾아보니 대게 어려운 방법이 많았다.. 그래서 찾은 방법 중에서 나에게 제일 알맞는 방법으로 구현해냈다.
constructor() {
super();
this.state = {
isProductListOn: false,
};
}
toggleProductList = () => {
this.setState({
isProductListOn: !this.state.isProductListOn,
});
};
<button
className="productListButton"
onClick={this.toggleProductList}>
Product +
</button>
<ul className={isProductListOn ? 'productList on' : 'productList off'}>