React selects the current problem

as shown in the figure below, I implemented it in the form of activeClassName , but the class selected in the first menu will not disappear.

< NavLink activeClassName= "cur" to= {item.path} > {item.name} < / NavLink >

clipboard.png

import React, { Component } from "react";
import { NavLink } from "react-router-dom"
class Head extends Component{
    render(){
        let navs = [
            {
                path:"/",
                name:""
            },
            {
                path:"/profile",
                name:""
            },
            {
                path:"/product",
                name:""
            },
            {
                path:"/content",
                name:""
            }
        ]
        return (
            <header>
                <nav>
                    {
                       navs.map((item,i) => {
                        return <li key={i} ><NavLink activeClassName="cur" to={item.path}>{item.name}</NavLink></li>
                       }) 
                    }
                </nav>
            </header>
        )
    }
}
export default Head;

I don't know what your code is, the most basic implementation:

class extends React.Component {

    constructor(props) {
        this.stete = {active: 1}
    }
    
    render() {
        return (
            <div>
                <Menu className={this.state.active === 1 && 'cur' || undefined} onClick={() => this.setState({active : 1})}>menu 1</Menu>
                <Menu className={this.state.active === 2 && 'cur' || undefined} onClick={() => this.setState({active : 2})}>menu 2</Menu>
                <Menu className={this.state.active === 3 && 'cur' || undefined} onClick={() => this.setState({active : 3})}>menu 3</Menu>
            </div>
        );
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b829-2b21a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b829-2b21a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?