“convertir jQuery en reactjs” Réponses codées

jQuery in 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

jQuery in 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

convertir jQuery en reactjs

$(function(){
  $('.btn').click(function(){
    $('body').hasClass('open') ? $('body').removeClass('open'):$('body').addClass('open')
  })
})
Daniel Vásquez

convertir jQuery en reactjs

$(function(){
  $('.btn').click(function(){
    $('body').hasClass('open') ? $('body').removeClass('open'):$('body').addClass('open')
  })
})
Daniel Vásquez

Réponses similaires à “convertir jQuery en reactjs”

Questions similaires à “convertir jQuery en reactjs”

Plus de réponses similaires à “convertir jQuery en reactjs” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code