skip to Main Content

I have tried importing jquery file in index.html for using jquery $ in react component.
And I tried like that $(‘button’).click(function()) in component.
At that time, I faced errors, $ is not undifined.
I think there are good ways to use jquery. Please feel free to answer me about that.

In index.html

In component
$("button").click(function(){})

2

Answers


  1. I can try that using node_module ‘jquery’.
    import $ from ‘jquery’;

    Login or Signup to reply.
  2. You can use like that.
    In component
    window.$(‘button’).click(function(){})

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search