Hi i have state const [value,setValue] = useState(0);
And a function A to setValue:
Eg:
`const A=()=>{
const temp= 0;
setValue(temp);
}`
And also I’m having 3 input fields which types are numbers. So I want to add the two input fields values and populate it in 3rd field. function A is called on two input’s onChange event.
After entering the 1st input:
If i enter 25, the state only taking the value 2,
Then entered the 2nd input:
If i enter 26, the state is taking value as 27. But the value should be 51? How the updation can be done?
Venkatraman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.