How can i setState of object based on the condition #189
-
I have two state objects for input values and to store the error messages.
I am able to take the input and i have function that checks and return true if any value is empty
I am able to loop over the input values and print the error message in console.
However, I want someone to help me set this message in error state object with their respective keys so i can show them on screen. i feel helpless with syntax |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
First of all, why do you need two state objects? |
Beta Was this translation helpful? Give feedback.
-
@atapas actually i wasn't sure how to setState of nested object but now i have found the way and its working. |
Beta Was this translation helpful? Give feedback.
-
yes , here it goes. I am making sure that my code is clean, concise and minimal. That's why its taking so long
|
Beta Was this translation helpful? Give feedback.
yes , here it goes. I am making sure that my code is clean, concise and minimal. That's why its taking so long