// Tabs.jsx import React from 'react' const TabContext = React.createContext() function Tabs({ children }) { const [selectedTab, setTab] = React.useState(initialTab) return ( ) } Tabs.Item = ({ value, children }) => { const ctx = React.useContext(TabContext) if (ctx === undefined) { throw new Error(' 컴포넌트는 컴포넌트 아래에서만 사용될 수 있습니다.') } const { selectedTab, setTab } = ctx return (
  • setTab(value)} className={`tab-item ${selectedTab === value ? 'selected' : ''}`} > {children}
  • ) }