I have some inputs defined in react. I'm assigning a function to their onChange
function. I can find the current value. How can I get the old value in simplest way?
The reason I want this is because I want to find the ratio of this new value to the old value and do some operations.
Sample code:
let onChange = (e) => {
let newValue = e.target.value; // let oldValue = will be here
}
<Input type="number" onChange={onChange }></Input>