DEV Community

MOHSIN ALI SOOMRO
MOHSIN ALI SOOMRO

Posted on

Add uniqui item to the array

code

const handleQualityChange=(e)=>{
    if(quality.find((i:any)=>i===e.target.value)){
      const index = quality.indexOf(e.target.value)
      quality.splice(index,1)
      console.log({quality})
    }else{
      quality.push(e.target.value)
      console.log({quality})
    }
  }```

Enter fullscreen mode Exit fullscreen mode

Top comments (0)