Sameer Sheikh Sameer Sheikh - 2 years ago 82
Javascript Question

How can I use jQuery $(this) in react js function

I am working on reactjs and on click I am calling a function.

In that function I want to use jQuery

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?

Answer Source

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>;


and using jQuery in our case is not necessary

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download