const prefer={"cs":{"c1":true,"c2":true,"c3":false,"c4":true}}
setArray((prevArray)=>{
return prevArray.filter(function(array){
//code here
})
});
I want to set array on the basis of prefer object, like if c1 is true then is want to add it in the array Do I need to initialize the array too? In above example array=["c1","c2","c4"] . Also do we need filter method or can we use some other method