import { cloneElement, isValidElement, ReactNode } from 'react'; export interface IslandProps { enabled: boolean; children: ReactNode; } export function Island({ enabled, children }: IslandProps) { // TODO: enabled === true 면 <div data-island="on">{children}</div> // TODO: 그 외에는 <div data-island="off">...</div>로 감싸고 // 자식이 단일 element면 onClick을 undefined로 덮어쓰기 return <div data-island="off">{children}</div>; }
Tests