This is Jsx import export problem. Please help. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

This is Jsx import export problem. Please help.

Js1.jsx : a = 3; export default a; Js2.jsx; import a from './Js1.jsx' There is this error : Cannot use import statement outside a module

27th Jun 2022, 5:52 AM
Sudip Shrestha
Sudip Shrestha - avatar
1 Réponse
0
If you are not going to export anything, use "require" instead of "import". You probably need to export from Js2.jsx in order to have a well defined module. The purpose of modules is to expose (by exporting) code anyways.
27th Jun 2022, 7:07 AM
Mustafa A
Mustafa A - avatar