I'm trying to use bootstrap in my react app, but it gives me aError: Bootstrap's JavaScript requires jQuery. I have imported jquery and have tried tried the following from other posts:
import $ from 'jquery';
window.jQuery = $;
window.$ = $;
global.jQuery = $;
However, I still get the not defined error.
The only way to fix this is to put
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
into index.html
is there a way to export jquery or have bootstrap be able to detect/read it?
I call my bootstrap via
import bootstrap from 'bootstrap'
nodecommand, and typerequire('jquery')in REPL, does it return a function? Asking just to make sure you have this dependency added to yarn lockfile.create-react-appwithjQueryrecently, it's notreact-react-appside problem.$("#select");works. It's mainly an issue with DataTables as it requires jQuery to be visible/usable by the window/global