allow dot path & bracket path for setFieldValue, setFieldTouched, & setFieldError
See original GitHub issueBug
The exposed interface for setFieldValue
, setFieldTouched
, & setFieldError
do not allow dot path names
Current Behavior
only first level field names can be set.
Desired Behavior
allow field names that contain dot path as well as bracket path.
Suggested Solutions
change the keyof Values
type for the field argument to string
Info
- Formik Version: 0.11.0-beta.1
- OS: MacOS High Sierra 10.13.2
- Node Version: 8.9.4
- Package Manager and version: npm 5.6.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
Top Results From Across the Web
reactjs - How do I access current value of a formik field without ...
My props don't have any "values" field. EDIT: Found an ugly way: document.getElementsByName("countryCode")[0].value . A better way is ...
Read more >formik - UNPKG
Sibling\n * objects along path retain the same internal js reference. ... order to keep array values consistent for both dot path and\n...
Read more >Arrays and Nested Objects - Formik
The name props in Formik can use lodash-like dot paths to reference nested ... Using lodash-like bracket syntax for name string you can...
Read more >formik @ 1.5.2 .. 1.5.4 - Package Diff
function setIn(obj, path, value) {. - var res = {}; ... setFieldValue=function(e,t,i){void 0===i&&(i=!0),r.didMount&&r. ... setFieldError,setFieldTouched:r.
Read more >s28.bitdl.ir/Video/OREILLY_STRATA_DATA_AND_AI_SUPE...
If the value at `path`\n * has changed, return a shallow copy of obj with ... to keep array values consistent for both...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
please do the same for
FormikTouched<Values>
. same problem - we can’t access anything beyond top level values intouched
I’d just add a second overload that takes a string argument for when you pass something that isn’t a direct key. There’s no way in the typesystem today to concatenate strings, so there’s no way to represent a full object path string as a type.