“jQuery di React” Kode Jawaban

jQuery di React

import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';


//   react code here


$("button").click(function(){
    $.get("demo_test.asp", function(data, status){
        alert("Data: " + data + "\nStatus: " + status);
    });
});

// react code here
Frail Fox

Impor Perpustakaan Bereaksi JS


// ---- REACT JS -----
// using
<link rel="shortcut icon" href="%PUBLIC_URL%/js/bootstrap.min.js"> </link>
<script src="%PUBLIC_URL%/js/bootstrap.min.js"> </script>

// public
// --- js 
// ------ bootstrap.min.js
// --- css 
// ------ bootstrap.min.css
Zidane (Vi Ly - VietNam)

jQuery di React

Yes, we can use jQuery in ReactJs. Here I will tell how we can use it using npm.

step 1: Go to your project folder where the package.json file is present via using terminal using cd command.

step 2: Write the following command to install jquery using npm : npm install jquery --save

step 3: Now, import $ from jquery into your jsx file where you need to use.


import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';


//   react code here


$("button").click(function(){
    $.get("demo_test.asp", function(data, status){
        alert("Data: " + data + "\nStatus: " + status);
    });
});

// react code here
Frail Fox

bereaksi di jQuery

class SomePlugin extends React.Component {
  componentDidMount() {
    this.$el = $(this.el);    this.$el.somePlugin();  }

  componentWillUnmount() {
    this.$el.somePlugin('destroy');  }

  render() {
    return <div ref={el => this.el = el} />;  }
}
ama-lion

Jawaban yang mirip dengan “jQuery di React”

Pertanyaan yang mirip dengan “jQuery di React”

Lebih banyak jawaban terkait untuk “jQuery di React” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya