I encountered a problem when using the name of a custom string list #3897
Unanswered
hiiiiiiixiaohui
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
### demo code:
<Formik isInitialValid={true} initialValues={{ first: { name: { flag: '1', }, }, }} onSubmit={(values) => { console.log('values', values); }} > {(props) => ( <Form onSubmit={props.handleSubmit}> <p>test: </p> <Field name={['first', 'name', 'flag']} placeholder="123" /> <button type="submit">Submit</button> </Form> )} </Formik>
I saw the official statement about name that you can use a string list as the key of the form. At this moment, my name is consistent with the structure in the initialization value.
When initializing rendering, the initialized value can also be displayed normally:
When I try to modify the value of the input box, the value of the input box cannot be updated.
After I pressed the submit button again, there was an extra spliced key in the value printed on the console:
I'm curious about what this name that supports string list format does, or is this a flaw?
version:
"formik": "^2.4.5"
Beta Was this translation helpful? Give feedback.
All reactions