I need help transforming a set that constantly changes with a button click (it could have more components or less depending on how the user is filtering his options). The sets are successfully changing and saving the options in a useState constant
const [conditionFilter, setConditionFilter] = useState(new Set());
const [colorFilter, setColorFilter] = useState(new Set());
Here is how some sets may look like
//this is the output of conditionFilter
{
0: "isNew"
1: "isUsed"
}
// both sets may increase their size depending on the amount of filters selected
//this set is the output of colorFilter
{
0: "isBlack"
1: "isYellow"
2: "isGreen"
}
And this is my desired output
filtersSelected = {
condition: ["isNew","isUsed"]
color: ["isBlack", "isYellow", "isGreen"]
};