score:3

Accepted answer
import React, { useState, useEffect } from 'react';

function App() {

  const [numero, setNumero] = useState(0)
  const [dato, setDato] = useState(0)
  
  useEffect(() => {
    let nuevoDato = numero * 5;
    setDato(nuevoDato);
  }, [numero])

  return (
    <div className="container mt-5 text-center">
      <h1>React</h1>  
      <input onChange={(e) => setNumero(e.target.value)} value={numero}/>
      <br/>
      <span>El numero x 5 es : {dato}</span>
    </div>
  );
}

export default App;

score:1

import React, { useState, useEffect } from 'react';

function App() {
  const [numero, setNumero] = useState(0)
  const [dato, setDato] = useState(0)

  useEffect(() => {
    setDato(numero * 5);
  }, [numero]);
 

  const changeValue = (value) => {
    setNumero(value);
  }

  return (
    <div className="container mt-5 text-center">
      <h1>React</h1>  
      <input onChange={(e) => changeValue(e.target.value)} value={numero}/>
      <br/>
      <span>El numero x 5 es : {dato}</span>
    </div>
  );
}

export default App;

Related Query

More Query from same tag