I have a form and I am attempting to populate the initialValues with data returned from an API request.
const [customer, setCustomer] = useState({});
getCustomer(props.oidc, params).then((result) => {
setCustomer(result[0]);
});
initialValues={customer}
I can see the data coming thru, although it does take it a second to return. I can see the state updating, but the data does not appear to be populating in the form. Is the data supposed to populate or am I missing something?
In general, also similar issue can occur if the initialValues are original an empty object. In those cases, we have to use this approach when the request is received:
https://www.telerik.com/kendo-react-ui/components/form/advanced-scenarios/#toc-resetting-the-form-initial-state