How to remove duplicate value from option in react js?

Answer

We need to remove redundant value from the second array before looping.


<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>

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---