2017-09-26 64 views
0

我不得不使用引导reactjs,当我尝试导入Bootstrap.js它给了我错误引导的JavaScript需要的jQuery - Reactjs

引导的JavaScript需要jQuery的

这里是我的进口报表(我试过以下)

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'; 

没有什么似乎在这里工作。

+2

我认为你需要的jQuery添加到您的HTML文件 –

+0

添加到HTML文件文件,删除错误了。谢谢:) –

+0

很高兴我可以帮助:) –

回答

1

在HTML文件中:

<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> 
1

您可以使用React Bootstrap以及替代选项。它具有Bootstrap的所有元素,加上它与ReactJS元素很好地融合在一起。