Lucrul cu mai multe input-uri în React

Să presupunem că avem două input-uri, în care vor fi introduse numere. Să facem astfel încât pe măsură ce introducem în paragraf să fie afișată suma celor două input-uri:

jsxfunction App() {
  const [value1, setValue1] = useState(0);
  const [value2, setValue2] = useState(0);
  
  function handleChange1(event) {
    setValue1(+event.target.value);
  }
  
  function handleChange2(event) {
    setValue2(+event.target.value);
  }
  
  return <div>
    <input value={value1} onChange={handleChange1} />
    <input value={value2} onChange={handleChange2} />
    <p>rezultat: {value1 + value2}</p>
  </div>
}
Задание 1

Sunt date 5 input-uri. Faceți astfel încât la introducerea numerelor în input-urile noastre în paragraf să fie afișată media aritmetică a numerelor introduse.