← スキル一覧に戻る

react-compound-components
by oalkabouss
⭐ 0🍴 0📅 2026年1月19日
SKILL.md
name: react-compound-components description: React compound components pattern (safe, minimal context, ergonomic API) compatibility: opencode license: MIT metadata: stack: node-react-next style: solid-clean-code
What I do
Je fournis un guide pour implémenter des Compound Components sûrs :
- contexte minimal
- API ergonomique
- erreurs explicites
Minimal template
type Ctx = { id: string };
const Ctx = createContext<Ctx | null>(null);
export function Root({ id, children }: { id: string; children: ReactNode }) {
return <Ctx.Provider value={{ id }}>{children}</Ctx.Provider>;
}
Root.Label = function Label({ children }: { children: ReactNode }) {
const ctx = useContext(Ctx);
if (!ctx) throw new Error('Root.Label must be used within Root');
return <label htmlFor={ctx.id}>{children}</label>;
};
When NOT to use
- Si l'état partagé devient complexe : passer à props explicites + hook.
スコア
総合スコア
45/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です