Home > Web Front-end > JS Tutorial > Detailed explanation of steps for jquery to reference React

Detailed explanation of steps for jquery to reference React

php中世界最好的语言
Release: 2018-04-19 15:22:57
Original
2128 people have browsed it

This time I will bring you jqueryquoteReact step-by-step explanation, what are the precautions for jquery to quote React, the following is a practical case, let’s come together take a look.

It’s more fun to reference Jquery in React, and get more data about elements

Introduction method examples:

import $ from 'jquery';
import { Button } from 'antd';
class testJquery extends React.Component {
  constructor(props) {
    super(props);
    this.selectElement = this.selectElement.bind(this);
  }
  render() {
    return(
      <p>
        <Button onClick={this.selectElement}>点击一下</Button>
        <h4 className="text">这是:12</h4>
      </p>
    );
  }
  selectElement() {
    console.log('text对象:',$('.text'));
    console.log('text中的值:',$('.text')[0].textContent);
  }
}
export default testJquery;
Copy after login

I believe you have mastered the method after reading the case in this article , for more exciting content, please pay attention to other related articles on the php Chinese website!

Recommended reading:

jQuery determines whether to browse to the bottom of the web page

jquery uses iscorll to implement pull-up loading on the mobile phone Pull down to refresh

The above is the detailed content of Detailed explanation of steps for jquery to reference React. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template