This is pretty straightforward. Let's say I have some NavBar component:
import React from 'react';
import styles from './NavBar.module.css';
export default function NavBar() {
return(
<nav className={styles.nav}>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</nav>
);
}
And now I have a NavBar.module.css file:
.nav {
display: flex;
padding: 20px;
background: #6dd3d6;
}
But since I am using the semantic tag and the benefit of using css-modules is that they cannot cause name interference,
is it somehow possible to directly style the nav without having to pass the styles class?
Like
import styles from './NavBar.module.css';
export default function NavBar() {
return(
<nav>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</nav>
);
}
with
nav {
display: flex;
padding: 20px;
background: #6dd3d6;
}