Noman Ali Noman Ali - 26 days ago 8
Javascript Question

Bootstrap's JavaScript requires jQuery - Reactjs

I have to use bootstrap with reactjs and when i try to import Bootstrap.js it gives me error


Bootstrap's JavaScript requires jQuery


Here is my import statements (I tried following)

import $ from 'jquery';
import jQuery from 'jquery'; //I installed jquery using npm
import '@shopify/polaris/jquery'; //I put jquery.js file
import '@shopify/polaris/bootstrap';


Nothing is seems to work here.

Answer Source

in your HTML file:

<html>
      <head>

           ..................
           ..................
           ..................
      </head>

      <body>
           ..................
           <script src="jquery.js"></script> // <<<<<< you missing import jquery here
           <script src="bootstrap.js"></script> // <<<<<<< you have this one
           ..................
      </body>
</html>