'How do I checkbox checked/unchecked when I edit the record in react/redux
Code
const [checkedItems, setCheckedItems] = useState<any>(false)
<Checkbox
checked={checkedItems[condition?.condition_id]}
label="Pediatric"
onChange={(e) => {
handleCheckbox(
e,
condition?.condition_id,
'pediatric_flag'
)
}}
id={`conditionid-${condition?.id}`}
/>
const handleCheckbox = (e, conditionId, flag) => {
setCheckedItems({ ...checkedItems, [e.target.id]: e.target.checked })
}
I want to make checkboxes checked or unchecked based on getting data from APIs. Someone, please help me with this concern.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
