Using availity-reactstrap-validation, when form fields (AvField) is populated with null data from backend I get an warning saying:
Warning:
value
prop oninput
should not be null. Consider using an empty string to clear the component orundefined
for uncontrolled components.
I try to exchange null values with empty strings, like the warning says, but to no avail.
<AvField type="text" name="offerKey" value={ data.offerKey === null ? '' : data.offerKey } />
If a add a blank space as value the warning disappears but then the placeholder text won't appear in the text box.
Is this a bug or a feature?
You can set your value in the state with null or empty string ('')
state = {
value: ''
}
or you can change your logic for:
value={ data && data.offerKey ? data.offerKey : '' }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.