Using jQuery in SharePoint framework web parts
For some developers, jQuery is an integral part of JavaScript development. From a broader perspective, jQuery is just a DOM manipulation library, but the popularity of the library is unquestionable. With only a few lines of code, jQuery allows developers to handle DOM manipulation, event handling, and Ajax calls in a very simplified manner. Using jQuery helps developers write browser independent code, although this is not a significant advantage in SharePoint Framework development since TypeScript already does that.
The obvious downside is that by loading external frameworks, such as jQuery, you're effectively adding to the overall page payload, which in turn might not be helpful in the long run if you only use jQuery for a simple feature.
Loading jQuery from CDN
First, we install typings for jQuery with the following command on the project's root folder:
npm install --save @types/[email protected]
Next, open the config.json
and add the following external...