Sharing state between components in code
function Accordion() {
const [openId, setOpenId] = useState(null);
return <Panel open={openId === "a"} onOpen={() => setOpenId("a")} />;
}Read the example from data and control flow to the resulting UI. Keep the component boundary small.