我需要更新CSS,自然我使用jQuery,但我被告知不要在React中使用jQuery。- 如何在我的React組件中轉換jQuery代碼?
我該如何正確地做到這一點。如果需要,我可以添加更多的代碼。我只是簡單地切換一個div的底部邊框
toggleMarker() {
if (this.state.previous && (this.state.current !== this.state.previous)) {
$('#nav_' + this.state.previous).css("border-bottom", '');
}
if (this.state.previous !== this.state.current) {
$('#nav_' + this.state.current).css("border-bottom", this.color);
}
this.setState({previous: this.state.current});
}
你給不使用jQuery的原因是什麼? –