I am learning React.js with the create-react-app framework.
I need to use a readymade admin template which has javascript files calling other JS files' modules.
e.g. In App.js I have:
1. import $ from 'jquery'
2. import Layout from './css/layout.min.js'
3. import Navbar from './js/navbar.min.js'
In navbar.min.js, I am getting an error:
1. $ is not defined
2. Layout (a function of layout.min.js) is not defined
There are hundreds of such modules so manual import from each JS is not an option.
So far I've tried exporting $, Layout from App.js but no results.
Any help would be appreciated.
You should do ( id you didn't)
npm i jquery --save
And in your layout.min.js you should have export default
.
Btw, maybe it should be import Layout from './js/layout.min.js'?