Question:I have the following code where I am trying to update the value for the select tag.
If I start with the value Male and change it to Female, the value of selectValue in NameTag is still Male. If I change the value again (say to Not Specified), the value of selectValue changes to Female.
(Note: I noticed that this is working properly for other React components. I tested with components that render text boxes and text areas.)
Answer:You are sending the old state value through the callback. setState is async.
If you have better answer, please add a comment about this, thank you!