on-internet
← Community

React material ui select all checkbox

Stack Overflow ·

I need to make that when selecting checkbox Select All, the rest of the checkboxes from the list are checked, and each checkbox can be selected separately. But when select one of the checkboxes does not checked the previous checkbox. sandbox const options = [ 'Selected Item 1', 'Selected Item 2', 'Selected Item 3']; export default function App() { const [selected, setSelected] = useState([]); const isAllSelected = options.length > 0 && selected.length === options.length; const handleChange = (event) => { const value = event.target.value; console.log(value) if (value === "all") { setSelected(se

Comments

Sign in or sign up to comment and upvote.

No comments yet.