'how to remove duplicate value from option in react js?
Code:-
<select id="lang" value={comment.ChannelName} autoFocus
className="btn_primary" onChange={e => setPlayer(e.target.value, comment.idx)} >
<option value="select">{comment.ChannelName}</option>
{selectedData.map((val) => {
// setCHANNEL = val;
//console.log("val", val)
return (
<>
{
val.map((val1, inde) => {
return (
<option value={val1 ? val1 : ""}>{val1}</option>
)
})
}
</>
)
})
}
</select>
[![enter image description here][1]][1]
Showing duplicate value in option i have api like this:-
{
"Clips": [
{
"AutoPlayMode": true,
"ClipName": "Evernote Hacked, Time t_STRA005R",
"Status": 1,
"ChannelName": "A",
}
],
"Players": "A,B"
}
i when channelName A is selected option doesn't repeat the players in option as on B also [1]: https://i.stack.imgur.com/mA7hq.png
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
