【发布时间】:2021-08-14 00:26:59
【问题描述】:
在 next.js 的变量中包含双破折号 (--) 会引发错误。 JSX 表达式必须有一个父元素。
变量名是'构成__subtitle--bar'。
{${styles.constitution__subtitle} ${styles.constitution__subtitle--bar}}
为什么 next.js 不允许在变量中使用双破折号 (--)?
【问题讨论】:
标签: next.js
在 next.js 的变量中包含双破折号 (--) 会引发错误。 JSX 表达式必须有一个父元素。
变量名是'构成__subtitle--bar'。
{${styles.constitution__subtitle} ${styles.constitution__subtitle--bar}}
为什么 next.js 不允许在变量中使用双破折号 (--)?
【问题讨论】:
标签: next.js
js中的变量名中不允许出现破折号。
尝试使用${styles["constitution__subtitle--bar"]}
【讨论】: