0

Upgrading from MUI4-MUI5 using tss-react in some files we have multiple styles import

 const { classes } = GridStyles();
 const { classes } = IntakeTableStyles();
 const { classes } = CommonThemeStyles();

and it shows 'Cannot redeclare block-scoped variable 'classes'' error is there any way to import multiple makeStyles?

Trying to import multiple makeStyles

 const { classes } = GridStyles();
 const { classes } = IntakeTableStyles();
 const { classes } = CommonThemeStyles();

i need to name each styles with different name instead of classes

Olivier Tassinari
  • 8,238
  • 4
  • 23
  • 23
  • You can have [named destructuring assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assigning_to_new_variable_names). – Ugur Eren Jul 13 '23 at 05:35

1 Answers1

0

Assigning to new variable names

A property can be unpacked from an object and assigned to a variable with a different name than the object property.

 const { classes: rfpGridClasses } = RfpGridStyles();
 const { classes: intakeTableClasses } = IntakeTableStyles();
 const { classes: commonThemeClasses } = CommonThemeStyles();
Lin Du
  • 88,126
  • 95
  • 281
  • 483