Answer the question
In order to leave comments, you need to log in
Why is activeClassName not working in React.js?
import React from 'react';
import s from './Nav.module.css';
import { NavLink } from 'react-router-dom';
const Navbar = () => {
return (
<nav className={s.nav}>
<div className={s.item}>
<NavLink to="/profile" activeClassName={s.selected}>Profile</NavLink>
</div>
<div className={s.item}>
<NavLink to="/dialogs" activeClassName={s.selected}>Dialogs</NavLink>
</div>
<div className={s.item}>
<a href="/#">Music</a>
</div>
<div className={s.item}>
<a href="/#">Settings</a>
</div>
</nav>
)
}
export default Navbar;
activeClassName="selected"
Answer the question
In order to leave comments, you need to log in
I decided by launching the project not through cmd, but through the VS Code console.
Gods!!
You just saved my monitor from death.
I already wanted out of rage why it doesn’t work, throw everything away and become a courtesan, as in that joke
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question