Hoc Pattern
Teaches the Higher-Order Component (HOC) pattern for logic reuse. Use when you need to share cross-cutting concerns like authentication, logging, or data fetching across multiple components.
Install
npx skills add PatternsDev/skills --skill hoc-patterngit clone --depth 1 https://github.com/PatternsDev/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/react/hoc-pattern ~/.claude/skills/hoc-patternPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# HOC Pattern ## Table of Contents - [When to Use](#when-to-use) - [When NOT to Use](#when-not-to-use) - [Instructions](#instructions) - [Details](#details) - [Source](#source) Within our application, we often want to use the same logic in multiple components. This logic can include applying a certain styling to components, requiring authorization, or adding a global state. One way of being able to reuse the same logic in multiple components, is by using the **higher order component** pattern. This pattern allows us to reuse component logic throughout our application. ## When to Use - Use this when the same uncustomized behavior needs to be applied to many components - This is helpful when a component should work standalone without the added custom logic ## When NOT to Use - When custom hooks can achieve the same result with less nesting and better readability - In new React 18+ code where hooks are the idiomatic approach to sharing stateful logic - When the HOC wrapper adds prop-name collisions or obscures the component tree in DevTools ## Instructions - Create a function that takes a component and returns a new component with enhanced behavior - Avoid naming collisions by renaming or merging props in the HOC - Prefer React Hooks over HOCs for most new code to avoid wrapper hell and deep nesting - Compose multiple HOCs carefully and be aware that the order of composition matters ## Details
Details
- Skill name
hoc-pattern- Repository
- PatternsDev/skills
- Path
react/hoc-pattern/SKILL.md- Repo updated
- 15 April 2026
FAQ
What does the Hoc Pattern skill do?
Teaches the Higher-Order Component (HOC) pattern for logic reuse. Use when you need to share cross-cutting concerns like authentication, logging, or data fetching across multiple components.
How do I install the Hoc Pattern skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add PatternsDev/skills --skill hoc-pattern. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Hoc Pattern popular?
It lives in PatternsDev/skills, which has 259 GitHub stars and 28 forks.
Related skills
AI UI Patterns
259PatternsDev/skills
Teaches design patterns for building AI-powered React interfaces. Use when creating chatbots, intelligent assistants, streaming UIs, or any AI-driven user experience in React.
Async Components
259PatternsDev/skills
Teaches async component loading in Vue for performance optimization. Use when you have heavy components that aren't needed on initial render and can be loaded on demand.
Bundle Splitting
259PatternsDev/skills
Teaches bundle splitting techniques for web performance. Use when your application has a large JavaScript bundle that affects load times or when you need to reduce FCP/LCP.
Hooks Pattern
259PatternsDev/skills
Teaches React Hooks for reusing stateful logic across components. Use when extracting shared behavior like form handling, subscriptions, or side effects into reusable custom hooks.
Dynamic Components
259PatternsDev/skills
Teaches dynamic component switching with Vue's <component> element. Use when you need to render different components conditionally based on runtime state using the is attribute.
Incremental Static Rendering
259PatternsDev/skills
Teaches Incremental Static Regeneration (ISR) for updating static content post-build. Use when you have static pages that need periodic updates without a full site rebuild.
Browse the most popular Claude skills, all frontend & design skills, or write your own with the skills generator.