/react-19:composing-componentsfrom react-19
Teaches component composition patterns in React 19 including children prop, compound components, and render props. Use when designing component APIs, creating reusable components, or avoiding prop drilling.
Ships in react-19. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When to Use:
function Card({ children, header, footer }) {
return (
<div className="card">
{header && <div className="header">{header}</div>}
<div className="body">{children}</div>
{footer && <div className="footer">{footer}</div>}
</div>
);
}
<Card header={<h2>Title</h2>} footer={<button>Action</button>}>
<p>Card content goes here</p>
</Card>;
import { createContext, use } from 'react';
const TabsContext = createContext(null);
export function Tabs({ children, defaultTab }) {
const [activeTab, setActiveTab] = useState(defaultTab);
return (
<TabsContext value={{ activeTab, setActiveTab }}>
<div className="tabs">{children}</div>
</TabsContext>
);
}
export function TabList({ children }) {
return <div className="tab-list">{children}</div>;
}
export function Tab({ id, children }) {
const { activeTab, setActiveTab } = use(TabsContext);
return (
<button className={activeTab === id ? 'active' : ''} onClick={() => setActiveTab(id)}>
{children}
</button>
);
}
export function TabPanel({ id, children }) {
const { activeTab } = use(TabsContext);
if (activeTab !== id) return null;
return <div className="tab-panel">{children}</div>;
}
Usage:
<Tabs defaultTab="profile">
<TabList>
<Tab id="profile">Profile</Tab>
<Tab id="settings">Settings</Tab>
</TabList>
<TabPanel id="profile">
<Profile />
</TabPanel>
<TabPanel id="settings">
<Settings />
</TabPanel>
</Tabs>
function DataProvider({ render, endpoint }) {
const [data, setData] = useState(null);
useEffect(() => {
fetch(endpoint)
.then((res) => res.json())
.then(setData);
}, [endpoint]);
return render({ data, loading: !data });
}
<DataProvider
endpoint="/api/users"
render={({ data, loading }) => (loading ? <Spinner /> : <UserList users={data} />)}
/>;
## Example: Modal with Composition
function Modal({ children, isOpen, onClose }) {
if (!isOpen) return null;
return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal" onClick={(e) => e.stopPropagation()}>
{children}
</div>
</div>
);
}
function ModalHeader({ children }) {
return <div className="modal-header">{children}</div>;
}
function ModalBody({ children }) {
return <div className="modal-body">{children}</div>;
}
function ModalFooter({ children }) {
return <div className="modal-footer">{children}</div>;
}
Modal.Header = ModalHeader;
Modal.Body = ModalBody;
Modal.Footer = ModalFooter;
Usage:
<Modal isOpen={showModal} onClose={() => setShowModal(false)}>
<Modal.Header>
<h2>Confirm Action</h2>
</Modal.Header>
<Modal.Body>
<p>Are you sure you want to proceed?</p>
</Modal.Body>
<Modal.Footer>
<button onClick={() => setShowModal(false)}>Cancel</button>
<button onClick={handleConfirm}>Confirm</button>
</Modal.Footer>
</Modal>
For comprehensive composition patterns, see: research/react-19-comprehensive.md lines 1263-1293.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub djankies/claude-configs --plugin react-1926 skills in this plugin
/following-the-rules-of-hooksFix React Rules of Hooks violations - conditional calls, hooks in loops/callbacks/classes/implementing-code-splittingTeaches code splitting with lazy() and Suspense in React 19 for reducing initial bundle size. Use when implementing lazy loading, route-based splitting, or optimizing performance./implementing-optimistic-updatesTeaches useOptimistic hook for immediate UI updates during async operations in React 19. Use when implementing optimistic UI patterns, instant feedback, or reducing perceived latency.Other plugins' skills for the same job