React function hooks
hi, i have try pass a value parent to child but i fail, someone know why the rthe code dont'worck? thank's import React, { useState } from "react"; import ReactDOM from "react-dom"; function MostraValore() { const [valore, setValore] = useState("pippo"); console.log(valore); function cattura(event) { setValore(event.target.value); } return ( <div> <p>Registra valore</p> <Input valore={valore} cattura={cattura} /> <Mostra /> </div> ); } function Input(props) { const { cattura, valore } = props; console.log(valore); return ( <div> <input type="text" valore={valore} onChange={cattura} /> </div> ); } function Mostra(props) { const { valore } = props; console.log(valore); return ( <div> <h2>Questo è il valore </h2> <p>{valore}</p> </div> ); } ReactDOM.render(<MostraValore />, document.getElementById("root")); https://stackblitz.com/edit/react-simple-list-example-zdlbhf?file=index.js