⊗jsrtPmFmsIO 57 of 112 menu

Changing Input Data When Outputting It in React

Let's say we're going to enter a number into the input. Let's make it so that as we enter a number into the input, the square of the number entered is displayed in the paragraph:

function App() { const [value, setValue] = useState(0); function handleChange(event) { setValue(event.target.value); } return <div> <input value={value} onChange={handleChange} /> <p>{value ** 2}</p> </div>; }

Input is given. A paragraph is given. Make it so that when text is entered into the input, the number of characters entered into the input is displayed in the paragraph.

enru