如何组织从自己的 React 库中导出的组件
How to organise exported components from own React library
我一直在开发一个组件库,我可以在我的 React 项目中重用它。我如何将这些组件导出为相关功能组,以便使用我的库的项目的相应导入语句如下所示?
import { Select1, Select2 } from 'myLib/Selects';
import { Button1, Button2 } from 'myLib/Buttons';
import { List1, List2 } from 'myLib/Lists';
// Selects.js
export {
Select1,
Select2
}
// Buttons.js
export {
Button1,
Button2
}
// Lists.js
export {
List1,
List2
}
我一直在开发一个组件库,我可以在我的 React 项目中重用它。我如何将这些组件导出为相关功能组,以便使用我的库的项目的相应导入语句如下所示?
import { Select1, Select2 } from 'myLib/Selects';
import { Button1, Button2 } from 'myLib/Buttons';
import { List1, List2 } from 'myLib/Lists';
// Selects.js
export {
Select1,
Select2
}
// Buttons.js
export {
Button1,
Button2
}
// Lists.js
export {
List1,
List2
}