3

I have loaded jquery via the npm, and I am trying to import jQuery in App.js of my React app like so:

import $ from 'jquery';

But it says:

Module not found: Can't resolve 'jquery'

Any idea what could be wrong here?

2
  • do you need to put something in front of jquery like js/jquery or node-modules/jquery? Commented Mar 27, 2018 at 20:14
  • also, have you looked here stackoverflow.com/questions/34338411/… Commented Mar 27, 2018 at 20:15

2 Answers 2

3

I didn't come up with a solution however doing an nmp install fixed this.

Sign up to request clarification or add additional context in comments.

Comments

2

You should install jQuery via npm or yarn.

npm install -S jquery

yarn add jquery

2 Comments

Sorry, this didn't help.
Also note you have to import jquery in every file you plan on using it in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.