[英]Is my jquery import slowing down create-react-app bundle time?
I have a create-react-app project with many components and they import jquery using ES6 modules as below. 我有一个包含许多组件的create-react-app项目,并且它们使用以下ES6模块导入jquery。
import $ from 'jquery'
The current build time is about 8 minutes and I feel it's because of jquery. 当前的构建时间约为8分钟,我认为这是由于jquery所致。
Did anyone face this before? 有人遇到过这个吗? If so what is the best way to use jquery in create-react-app
如果是这样,在create-react-app中使用jquery的最佳方法是什么
Using jquery
in react apps is undesirable because react
is declarative and jquery
is 100% imperative. 在React应用程序中使用
jquery
是不可取的,因为react
是声明性的,而jquery
是100%必需的。 It makes code less maintainable and readable. 它使代码的可维护性和可读性降低。 Also it makes hard to test your components.
而且,这也使得测试您的组件变得困难。 If you use jquery for ajax you can replace it for example with axios.
如果将jquery用于ajax,则可以将其替换为axios。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.