如何在tss-react中导入多个makeStyles?

huangapple go评论76阅读模式
英文:

how to import multiple makeStyles in tss-react?

问题

Upgrading from MUI4-MUI5 using tss-react
在一些文件中,我们有多个样式导入

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

并且显示错误 'Cannot redeclare block-scoped variable 'classes'',是否有方法导入多个 makeStyles?

尝试导入多个 makeStyles

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

我需要为每个样式命名不同的名称,而不是使用 classes。

英文:

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

答案1

得分: 0

 const { classes: rfpGridClasses } = RfpGridStyles();
 const { classes: intakeTableClasses } = IntakeTableStyles();
 const { classes: commonThemeClasses } = CommonThemeStyles();
英文:

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();

huangapple
  • 本文由 发表于 2023年7月13日 13:30:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76676193.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定