【问题标题】:Double Dashes in next.js variable does not worknext.js 变量中的双破折号不起作用
【发布时间】:2021-08-14 00:26:59
【问题描述】:

在 next.js 的变量中包含双破折号 (--) 会引发错误。 JSX 表达式必须有一个父元素。

变量名是'构成__subtitle--bar'。

{${styles.constitution__subtitle} ${styles.constitution__subtitle--bar}}

为什么 next.js 不允许在变量中使用双破折号 (--)?

【问题讨论】:

    标签: next.js


    【解决方案1】:

    js中的变量名中不允许出现破折号。

    尝试使用${styles["constitution__subtitle--bar"]}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-06
      • 1970-01-01
      • 1970-01-01
      • 2011-08-28
      • 1970-01-01
      • 2013-05-30
      • 1970-01-01
      相关资源
      最近更新 更多