// if we write like this , code will be fine <div className="node-item-container" onClick={()=>this.handleClick()}> <div className="corner left-top-conrner"> <img src={leftTopCorner}/> </div> <div className="corner right-top-conrner"> <img src={rightTopCorner}/> </div> <div className="corner left-bottom-conrner"> <img src={leftBottomCorner}/> </div> <div className="corner right-bottom-conrner"> <img src={rightBottomCorner}/> </div> <GlobalProjectContent /> </div>
// if we write like this, click event will be automatic run in page init <div className="node-item-container" onClick={this.handleClick()}> <div className="corner left-top-conrner"> <img src={leftTopCorner}/> </div> <div className="corner right-top-conrner"> <img src={rightTopCorner}/> </div> <div className="corner left-bottom-conrner"> <img src={leftBottomCorner}/> </div> <div className="corner right-bottom-conrner"> <img src={rightBottomCorner}/> </div> <GlobalProjectContent /> </div>
// so we need to select the first one , that will solve the problem