DEV Community

loading...

How to use kebab case for class name of css in Next.js

Nobu
I worked as a back-office staff for 3 years half before.Currently, I work at Agile Media Network in Tokyo.PHP/Symfony/Laravel, Javascript/React,Swift
・1 min read

Precondition

If I write kebab case like below, it will be error.

className={styles.company-logo}
Enter fullscreen mode Exit fullscreen mode

Solution

This will work.

className={styles['company-logo']}
Enter fullscreen mode Exit fullscreen mode

Reference
https://stackoverflow.com/questions/61794899/using-kebab-case-css-classnames-in-css-sass-modules-when-using-next-js

Discussion (0)