I am facing an issue with my script while using React and Next.js in my pages/_app.js file. The code snippet is as follows:
import axios from "axios";
import { $ } from "jquery";
import App from "next/app";
import Router from "next/router";
import { destroyCookie, parseCookies } from "nookies";
import Layout from "../components/_App/Layout";
import "../public/css/boot.css";
import "../public/css/icons.css";
import "../public/css/themes/style.css";
import "../public/jquery";
import "../public/scripts";
import baseUrl from "../utils/baseUrl";
// Rest of the code here
The complete code can be found at: https://codesandbox.io/s/dawn-mountain-vme5e?file=/pages/_app.js
I am encountering a ReferenceError where $ is not defined when I import my script into the _app.js file. This issue is causing my jQuery functions to not work correctly in my components.
I have searched for solutions but couldn't find any helpful resources to resolve this problem. It is hindering the progress of several projects that I am working on.
If you have any insights or suggestions on how to fix this issue, I would greatly appreciate your help. Thank you.