javascript
Select Multiple Items
const setSubCatModalItem = item => {
const array = selectedSubCat.map((val, ind) =>
val.id === item.id ? {...val, isSelected: !val.isSelected} : {...val},
);
setSelectedSubCat(array);
};
Was this helpful?
Similar Posts
- Assign items of arrays to multiple variable when creating it (Array Destructuring) Javascript(ES6)
- Get all values as array items from an Object in Javascript
- Remove items starting from last untill given condition is false Lodash
- Remove items begin from start until given condition is false Lodash
- Check if all array items are equal javascript
- Join array items and convert to string in javascript
- Remove duplicate items from array in Javascript
- JavaScript ES6 filtering object with multiple params