We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d94642 commit b0912d4Copy full SHA for b0912d4
1 file changed
src/Form.tsx
@@ -32,7 +32,11 @@ export const Form: React.FC<FormProps> = props => {
32
useEffect(() => {
33
// Set initial values
34
if (!isControlled) {
35
- setValue(Array.from({ length: sections.length }, () => ({})));
+ props.form.sections.forEach((section, index) => {
36
+ setValueAndPropagate(index, section.fields
37
+ .map(field => (field.initialValue !== undefined ? { [field.name]: field.initialValue } : {}))
38
+ .reduce((obj1, obj2) => ({ ...obj1, ...obj2 }), {}));
39
+ })
40
41
42
// setValueAndPropagate({
0 commit comments