1、安装jQuery

cnpm i jquery -S

2、在组件中引入jquery库

import React, { Component } from 'react'
import $ from 'jquery'

export class App extends Component {
    render() {
        return (
            <div>
                <div className="app">hello</div>
            </div>
        )
    }

    componentDidMount(){
        $(".app").mouseenter(()=>{
           console.log($(".app").text());
        });
    }
}

export default App

效果:
在react项目中使用jQuery库

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-02-10
  • 2021-08-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-27
  • 2021-04-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-06-27
相关资源
相似解决方案