From harness-claude
Implements React higher-order components (HOCs) to extend behavior with cross-cutting concerns like authentication, logging, analytics. For class components, third-party libs like Redux connect.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Extend component behavior by wrapping in a higher-order component
Implements React hooks pattern to extract and reuse stateful logic like data fetching or form state across components using custom hooks with TypeScript typing.
Designs scalable React components using functional components, hooks, composition patterns, and TypeScript. For building reusable component libraries and maintainable UI systems.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Extend component behavior by wrapping in a higher-order component
connect, React Router withRouter)with<Behavior> by convention.React.forwardRef if the wrapped component uses refs.displayName on the HOC result for debugging: WrappedComponent.displayName = \withAuth(${Component.displayName})``.function withAuthentication<P extends object>(
WrappedComponent: React.ComponentType<P>
) {
const WithAuth = (props: P) => {
const { isAuthenticated } = useAuth();
if (!isAuthenticated) return <Redirect to="/login" />;
return <WrappedComponent {...props} />;
};
WithAuth.displayName = `withAuthentication(${WrappedComponent.displayName ?? WrappedComponent.name})`;
return WithAuth;
}
HOCs are a functional composition pattern borrowed from functional programming. They were the primary code-reuse mechanism before hooks.
When to prefer hooks over HOCs:
Valid HOC use cases in modern React:
withTheme)React.memo and custom comparisonTypeScript note: HOC generic typing requires careful handling of ComponentProps and Omit to correctly type the enhanced component's props.
https://patterns.dev/react/hoc-pattern