// src/App.jsx import { useState } from "react"; function NameInput({ name, onNameChange }) { return ( onNameChange(e.target.value)} placeholder="Enter your name" /> ); } function NameGreeting({ name }) { return

Hello, {name || "stranger"}!

; } function Parent() { const [name, setName] = useState(""); return (
); } function App() { return ; } export default App; /* Notes: - name lives only in Parent — neither NameInput nor NameGreeting has its own copy of this state. - NameInput receives both the current value and a way to change it (onNameChange, which is really setName under a clearer prop name); NameGreeting only needs to read the value, so it receives just name. */