I am working on reactjs and on click I am calling a function.
In that function I want to use jQuery $this
to change the text of that element.
Is it possible to do so?
Or is there any way with reactjs to change the current elements text?
If you need just change text for element that was clicked you can do it like this
var Component = React.createClass({
handleClick(e) {
e.currentTarget.innerHTML = 'New Text';
},
render() {
return <div onClick={this.handleClick}>Change Text</div>;
}
});
Example
and using jQuery
in our case is not necessary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With