I\'m trying to organize my state by using nested property like this:
this.state = {
someProperty: {
flag:true
}
}
But updating
If you are using formik in your project it has some easy way to handle this stuff. Here is the most easiest way to do with formik.
First set your initial values inside the formik initivalues attribute or in the react. state
Here, the initial values is define in react state
state = {
data: {
fy: {
active: "N"
}
}
}
define above initialValues for formik field inside formik initiValues
attribute
{...your actions goes here}}
>
{({ isSubmitting }) => (
)}
Make a console to the check the state updated into string
instead of boolean
the formik setFieldValue
function to set the state or go with react debugger tool to see the changes iniside formik state values.