Lifting State Up
Move shared state to the nearest common parent and pass it down.
Example
function Parent() {
const [t, setT] = useState("");
return (
<>
<Input value={t} onChange={setT} />
<Preview text={t} />
</>
);
}Exercise
Shared owner.
The state lives in the Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.