setIsWorking(true);
const updatedData = helpers.normalizeData({ ...wizardData, ...stepData });
+
+ copyFields(updatedData, fieldsToCopy);
+
setWizardData(updatedData);
// Check if the selected state is a no fly statecopyFields is:
function copyFields(updatedData, mappings) {
for (const { from, to } of mappings) {
if (updatedData[from] && !updatedData[to]) {
updatedData[to] = updatedData[from];
}
}
}In the config send that new prop:
fieldsToCopy: [
{ from: "country", to: "personMailingCountryCode" },
{ from: "state", to: "personMailingState" }
]