Adicione a classe ativa ao Li OnClick React
const links = ['link1', 'link2', 'link3'];
const [active, setActive] = useState(null);
<ul>
{links.map((link) => (
<li className="nav-item">
<a
href={`#${link}`}
className={`nav-link ${active == link && 'm-active'}`}
onClick={() => setActive(link)}
>{link}</a>
</li>
))}
</ul>
bilalahmed_dev