Add jQuery to your NextJS App

The best way is to add jQuery via npm and include the inject file in the root file. Let me show you how.

npm install jquery --save
window.$ = window.jQuery = require('jquery')
import '[PathToFile]/inject.js'

const getPrincipalAmount= () => {

or you can also try this approach

import React from 'react';
import $ from 'jquery';

    alert("The p tag was clicked.");

// react component here

Leave a comment

Your email address will not be published. Required fields are marked *