Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用webpack在es6中进行多个或单个导入_Reactjs_Webpack_Ecmascript 6_Material Ui_React Boilerplate - Fatal编程技术网

Reactjs 使用webpack在es6中进行多个或单个导入

Reactjs 使用webpack在es6中进行多个或单个导入,reactjs,webpack,ecmascript-6,material-ui,react-boilerplate,Reactjs,Webpack,Ecmascript 6,Material Ui,React Boilerplate,我正在开发一个javascript SPA,其中包含React/React样板和。 在上的代码片段中,我看到: 从'@material ui/core/Table'导入表格; 从“@material ui/core/TableBody”导入表体; 从“@material ui/core/TableCell”导入TableCell; 从“@material ui/core/TableFooter”导入TableFooter在我看来,第二个稍微好一点,因为您不需要知道正在使用的库的内部结构。这样,

我正在开发一个javascript SPA,其中包含React/React样板和。 在上的代码片段中,我看到:

从'@material ui/core/Table'导入表格;
从“@material ui/core/TableBody”导入表体;
从“@material ui/core/TableCell”导入TableCell;

从“@material ui/core/TableFooter”导入TableFooter在我看来,第二个稍微好一点,因为您不需要知道正在使用的库的内部结构。这样,如果他们改变了文件夹的结构,你就不会受到影响。

如果没有任何类似的方法,这两种方法的区别在于:

import {Table,TableBody,TableCell,TableFooter} from '@material-ui/core/'
实际上,将
@material ui/core/'
添加到您的包中的所有内容

如果您确实只使用其中的一个子集,请选择:

import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableFooter from '@material-ui/core/TableFooter';
。。。将导致明显更小的捆绑