2
 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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

That worked but why didn't i use the dot (.) operator?
Because name variable cannot has "-". You need to read about naming of js variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.