<Script
src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossOrigin="anonymous"
></Script>
<Script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+"
crossOrigin="anonymous"
></Script>
<Script
type="text/javascript"
src="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/ace.js"
></Script>useEffect(() => {
$('#foo').click(function () {
console.log('click');
alert('click');
}
}, [])ReferenceError: $ is not defined but when I go into the console of the browser, $ is defined. There are a few other things that seem to depend on the availability of $ like the bootstrap and ace scripts I've imported. This is the problem I'd like to solve before I can start transitioning to using React components that have been made to wrap around the scripts with no issues. thank you.'use client';
import Link from 'next/link';
import { useEffect } from 'react';
import $ from 'jquery';
export default function Page() {
useEffect(() => {
$('body').css('background-color', 'orange');
}, []);
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Link href="/">Home</Link>
<Link href="/about">About</Link>
<Link href="/test-two">Test two</Link>
<h1 className="bg-slate-800 text-green-400">TEST TWO</h1>
</main>
);
}'use client';
import Link from 'next/link';
import { useEffect } from 'react';
import $ from 'jquery';
export default function Page() {
useEffect(() => {
$('body').css('background-color', 'orange');
}, []);
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Link href="/">Home</Link>
<Link href="/about">About</Link>
<Link href="/test-two">Test two</Link>
<h1 className="bg-slate-800 text-green-400">TEST TWO</h1>
</main>
);
}pnpm install @types/jquery -D$.material.init(); is undefined, which I'm going to take as a win since the other error went away