0

The code is as follows

import TableRow from "@mui/material/TableRow";

vs

import { TableRow } from "@mui/material";

Which one is better? Will there be any performance difference?

prajeesh
  • 2,202
  • 6
  • 34
  • 59

1 Answers1

0

The difference between these import statements is purely syntactical, when a module is imported, the entire module is loaded into memory, regardless of whether it has a default export or named exports. So, both import TableRow from "@mui/material/TableRow" and import { TableRow } from "@mui/material" would load the same module into memory., The choice between them depends on whether you want to import the default export of a module or a specific named export, the second one is more useful if you are importing more than one module.

Juan Velasquez
  • 385
  • 4
  • 15