Compound 패턴
Compound 패턴
Flyout 컴포넌트에 구현해야 할 요소
Flyout 컴포넌트 구현
const FlyOutContext = createContext()
function FlyOut(props) {
const [open, toggle] = useState(false)
const providerValue = { open, toggle }
return (
<FlyOutContext.Provider value={providerValue}>
{props.children}
</FlyOutContext.Provider>
)
}Toggle 컴포넌트 구현
Menu 컴포넌트 구현
장점
단점
Last updated