redux-form-material-ui
redux-form-material-ui copied to clipboard
Unable to set Checkbox to selected/unselected via code
I have a use case where I want to select the chkbox on the basis of data which I'm reading from an API.
So, If that particular checkbox was selected while posting to the data to the server, I want to make it selected then next time user looks for the same record.
I'm using these components: FormControlLabel from '@material-ui/core/FormControlLabel' Checkbox from 'redux-form-material-ui' and redux form
My Code is something like this-
<FormControlLabel
control={
<Field
name={${this.props.postParam}.${key}}
checked={ // some condition here on basis of remote api data }
component={this.checkboxAdapter}
/>
}
checkboxAdapter(inputProps) { console.log(inputProps) return ( <Checkbox {...inputProps} value={inputProps.input.value} onChange={inputProps.input.onChange} checked={inputProps.checked} />); }
This is still an issue, any progress?