【发布时间】:2021-09-16 12:46:25
【问题描述】:
嗯,我读过
https://medium.com/bootstart/you-should-be-using-folder-components-b30b7d165c39
文章作者将index.js 描述为一种治疗方法,并且在那篇文章中也有评论,其中另一个人说在每个组件中都使用index.js 是多余的。
但是! github上有很多这样的仓库
- https://github.com/discountry/react/tree/master/src/components
- https://github.com/geist-org/react/tree/master/components
- https://github.com/reactjs/reactjs.org/tree/master/src/components
他们在每个组件中使用index.js。
那么,我们必须使用它们吗?真的有必要吗?
【问题讨论】:
-
是的,当您进行导入时,它会让生活变得更轻松。
-
这完全是基于意见的
-
这个问题非常主观,很可能被关闭。我会考虑一种表达方式,它不仅仅依赖于轶事证据,甚至是纯粹的观点。
标签: javascript reactjs