Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 568 Bytes

use-jquery.md

File metadata and controls

22 lines (14 loc) · 568 Bytes

How to use jQuery

If you import jQuery into a react component and get a type definition error, you may need to install the jquery types:

npm install --save-dev @types/jquery

This package solves the error like $ is not defined and allows you to use jQuery within a React app.

You may want to import jQuery explicitly:

import $ from 'jquery'

According to react docs:

Just because it’s possible, doesn’t mean that it’s the best approach for React apps. We encourage you to use React components when you can.

References: *