Given a Select All checkbox - toggle the children's checkboxes in such a way that when the select all button is clicked, all the boxes are checked. Similarly, when the button is toggled, the checkboxes become unchecked.
Checkbox component that takes in checked, onChange and label as props.select all checkbox should be there that toggles the state of all the children checkboxes.select all checkbox should be unchecked.select all checkbox should be checked.listItems array that follows the following structure.NOTE: Use the list array given in the list.ts file to create all the checkboxes as shown in the demo.
export const list = [
{
id: 0,
name: 'Kingfisher',
},
{
id: 1,
name: 'Budweiser',
},
...
...
...
];
Click to reveal
Can you try using map and filter javascript methods to filter out or create a new array for state management?
Click to reveal
What is checked property, and how can it help you with your Checkbox component?
Click to reveal
Try mutating the original state object that is given, i.e. the list array. Try adding a isChecked property to see if the element is already checked or not.