Reputation: 7605
import classes from './NavBar.module.css';
then in the file I am trying to access the css module like this
<ul className={classes.navbar-nav}>
<li>Home</li>
</ul>
In my CSS Module file
.navbar-nav {
max-width: 100%;
max-height: 100%;
display: flex;
justify-content: flex-end;
}
The error I get is
'nav' is not defined no-undef
Upvotes: 2
Views: 86
Reputation: 12777
You should use classes["navbar-nav"]
. You can't use the dot operator because name variables cannot have -
.
For a better understanding, read about naming of javascript variables
Upvotes: 1