I want to display sum of the values entered in front of my label dynamically, it should added automatically, For eg: You can see the below image for referenceThis should be the output
I have set the state, but I am not getting the logic to add the numbers, I have just set the value, you can see the below image I have set just the value
Here is my code
// import logo from './logo.svg';
import React, {useState} from "react"
import './App.css';
function App() {
const [first, setfirst] = useState(0)
const addChange=(e)=>{
setfirst(e.target.value)
Math.
}
return (
<>
<label>Sum of inputs:{first} <input type="text" onChange={addChange}></input></label>
</>
);
}
export default App;
Please let know, if I need to provide some more details.