forms - reduxForm v5.3.1 uncontrolled/controlled warning on checkbox -
so, here warning:
warning: userinviteform changing uncontrolled input of type checkbox controlled.
after looking @ this ticket reduxform v5 , others, seems getting warning because initial value field undefined , input value attribute needs initialized either fields value || "".
do little further research, controlled checkboxes need checked attribute set value.
so assumption way clear warning write input tag in 1 of 2 ways:
<input {...isprimary} value={isprimary.value || ''} type="checkbox" >
or
<input {...isprimary} checked={isprimary.checked || ''} type="checkbox" >
for measure tried checked={isprimary.checked || false}
, value={isprimary.value || false}
, combination of both together.
i tried setting checked , value property of isprimary
on component mount still nothing can rid of warning.
also, want add, know there reduxform v6 out, current version of our deployed app working fix , reduxform v6 coming in future deployment version of our app.
anyone got insight solving problem?
i tried 1 more thing , figured out solution.
i able work setting initial value of field when connecting reduxform, set value of input intitial value.
userinviteformcontainer = reduxform({ form: form_id, fields: field_names, initialvalues: { isprimary: false, }, validate, })(userinviteformcontainer); <input {...isprimary} value={isprimary.initialvalue || ''} type="checkbox" >
Comments
Post a Comment