ReactJs, How can I add class name to Map of same divs

this is my code i’m trying to add a class on click to a clicked div but i have more than 1 div have the same classname so when i click to any
div the toggle class added to all divs not the one which i clicked what i want to know how can i specify the div which i want to add toggle class to it


    const [isActive, setActive] = useState(false);
    const toggleClass = () => {

    return (
        <div className="command_wrapper">
            <div className="command_list">
          , index) => {
                        return (
                            <div className="command" >
                                <div className="command_face" onClick={toggleClass}>
                                <div className={isActive ? "command_body" : "disapper"}>
                                    <div className="command_usage">
                                    <div className="command_required">
                                        <h1>Required Permissions</h1>


33 thoughts on “ReactJs, How can I add class name to Map of same divs”

Leave a Comment