<Field
defaultChecked={ true }
onChange={ this.handleFormItemRadio }
component={ "input" }
type={ "checkbox" }
name="tAdmin"
/>
When the field is initialized, I expect it to be checked but it renders unchecked even though I am supplying a true value.
I was pointed to number of solutions but am still not able to solve this.
According to the docs, the prescribed way is to set initialValues
<Field
onChange={this.handleFormItemRadio}
component="input"
type="checkbox"
name="tAdmin"
/>
...
export default reduxForm({
form: 'simple', // a unique identifier for this form
initialValues: { tadmin: true },
})(SimpleForm);
Here's a CodeSandbox example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With