javascript - How do I convert jQuery code in my React Component? -
i need update css, , naturally used jquery, i'm told not use jquery react.
how properly. can add more code if needed. i'm toggling bottom border of 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}); }
you can manipulate components style inline , can give conditions according state variables.
example
render(){ return( <div style={{ borderbottom: ((this.state.previous && (this.state.current !== this.state.previous)) ? 'none' : 1) }}> // ... </div> ) }
Comments
Post a Comment