having n number of dropdown menus in React JS. When I am clicking nth menu item, I want to open the corresponding dropdown menu. But what I am getting now is, on clicking a menu item, all the dropdowns are getting opened. How this can be achieved?
Code:-
const [isActive, SetisActive] = useState(false);
{
PlaylistData && PlaylistData.map((playdata) => {
return (
<td >
<div className="Dropdown">
<div className="Dropdown_btn" onClick={(e) => SetisActive(!isActive)}>{playdata.ChannelName}</div>
{isActive && (
Channelname.map((val, id) => {
{
return (
<Fragment key={id}>
{removeRedundant([...val, playdata.ChannelName]).map((val1) => {
return (
<div className="dropdown_content">
<div className="dropdown_item"
onClick={(e) => { setPlayer(val1, playdata.idx, StoreIdx) }}>{val1}</div>
</div>
)
})}
</Fragment>
)
}
})
)}
</div>
</td>