Answer the question
In order to leave comments, you need to log in
How to access object property by string key in React JS + Typescript?
There is a checkbox
<Checkbox
label="Is active?"
checked={fields.settings.is_active}
onChange={handleChange('is_active')}
/>
export type FormSettingsProps = {
setting_id: Field<number>,
icon_id: Field<number>,
is_active: Field<boolean>
...
}
const handleChange = (field: FormSettingsProps) => (value: boolean) => {
fields.settings[field].onChange(value);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question