Episode 2 — React Frontend Architecture NextJS / 2.10 — Advanced Reusability Patterns
2.10.a — Higher-Order Components (HOCs): reusing behavior by wrapping
Learning outcomes
- Define an HOC precisely and implement a simple one.
- Explain ref forwarding and
displayNamehygiene. - Argue when hooks replace HOCs for new code while still reading legacy HOCs.
Definition
A higher-order component is a function:
import type { ReactNode } from "react";
type Extra = { traceId: string };
type ComponentType<P> = (props: P) => ReactNode;
function withExample<P>(Wrapped: ComponentType<P>): ComponentType<P & Extra> {
return function WithExample(props: P & Extra) {
return <Wrapped {...props} />;
};
}
It takes a component, returns a component, and typically injects props (data, callbacks) or wraps behavior (logging, auth gates).
Classic example: injecting props
import type { ComponentType } from "react";
export function withTimestamp<P extends object>(Wrapped: ComponentType<P & { injectedNow?: number }>) {
function WithTimestamp(props: P) {
return <Wrapped {...props} injectedNow={Date.now()} />;
}
WithTimestamp.displayName = `withTimestamp(${(Wrapped as any).displayName ?? Wrapped.name ?? "Component"})`;
return WithTimestamp;
}
Note:
Date.now()in render is only illustrative; real code usually injects stable services.
Ref forwarding problem
If consumers need a DOM ref to the inner component, the HOC must use React.forwardRef or refs will attach to the wrong node.
Why hooks reduced HOC dominance
useQuery, useAuth, useTheme colocate logic without wrapping exports. HOCs remain in:
- legacy libraries
- cross-cutting concerns applied uniformly at route boundaries
- class-era codebases
Appendix — Scenario bank (basic → advanced)
Each card: symptom → cause → fix → interview phrase.
RP0-001 — HOCs #1
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
13. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-002 — HOCs #2
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
26. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-003 — HOCs #3
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
39. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-004 — HOCs #4
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
52. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-005 — HOCs #5
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
65. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-006 — HOCs #6
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
78. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-007 — HOCs #7
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
91. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-008 — HOCs #8
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
104. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-009 — HOCs #9
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
117. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-010 — HOCs #10
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
130. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-011 — HOCs #11
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
143. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-012 — HOCs #12
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
156. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-013 — HOCs #13
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
169. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-014 — HOCs #14
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
182. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-015 — HOCs #15
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
195. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-016 — HOCs #16
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
8. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-017 — HOCs #17
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
21. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-018 — HOCs #18
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
34. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-019 — HOCs #19
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
47. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-020 — HOCs #20
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
60. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-021 — HOCs #21
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
73. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-022 — HOCs #22
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
86. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-023 — HOCs #23
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
99. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-024 — HOCs #24
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
112. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-025 — HOCs #25
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
125. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-026 — HOCs #26
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
138. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-027 — HOCs #27
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
151. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-028 — HOCs #28
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
164. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-029 — HOCs #29
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
177. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-030 — HOCs #30
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
190. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-031 — HOCs #31
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
3. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-032 — HOCs #32
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
16. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-033 — HOCs #33
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
29. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-034 — HOCs #34
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
42. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-035 — HOCs #35
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
55. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-036 — HOCs #36
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
68. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-037 — HOCs #37
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
81. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-038 — HOCs #38
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
94. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-039 — HOCs #39
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
107. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-040 — HOCs #40
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
120. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-041 — HOCs #41
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
133. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-042 — HOCs #42
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
146. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-043 — HOCs #43
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
159. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-044 — HOCs #44
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
172. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-045 — HOCs #45
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
185. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-046 — HOCs #46
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
198. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-047 — HOCs #47
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
11. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-048 — HOCs #48
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
24. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-049 — HOCs #49
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
37. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-050 — HOCs #50
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
50. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-051 — HOCs #51
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
63. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-052 — HOCs #52
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
76. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-053 — HOCs #53
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
89. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-054 — HOCs #54
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
102. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-055 — HOCs #55
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
115. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-056 — HOCs #56
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
128. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-057 — HOCs #57
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
141. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-058 — HOCs #58
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
154. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-059 — HOCs #59
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
167. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-060 — HOCs #60
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
180. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-061 — HOCs #61
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
193. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-062 — HOCs #62
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
6. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-063 — HOCs #63
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
19. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-064 — HOCs #64
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
32. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-065 — HOCs #65
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
45. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-066 — HOCs #66
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
58. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-067 — HOCs #67
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
71. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-068 — HOCs #68
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
84. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-069 — HOCs #69
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
97. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-070 — HOCs #70
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
110. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-071 — HOCs #71
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
123. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-072 — HOCs #72
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
136. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-073 — HOCs #73
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
149. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-074 — HOCs #74
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
162. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-075 — HOCs #75
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
175. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-076 — HOCs #76
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
188. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-077 — HOCs #77
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
1. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-078 — HOCs #78
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
14. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-079 — HOCs #79
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
27. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-080 — HOCs #80
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
40. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-081 — HOCs #81
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
53. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-082 — HOCs #82
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
66. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-083 — HOCs #83
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
79. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-084 — HOCs #84
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
92. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-085 — HOCs #85
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
105. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-086 — HOCs #86
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
118. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-087 — HOCs #87
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
131. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-088 — HOCs #88
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
144. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-089 — HOCs #89
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
157. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-090 — HOCs #90
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
170. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-091 — HOCs #91
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
183. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-092 — HOCs #92
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
196. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-093 — HOCs #93
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
9. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-094 — HOCs #94
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
22. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-095 — HOCs #95
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
35. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-096 — HOCs #96
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
48. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-097 — HOCs #97
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
61. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-098 — HOCs #98
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
74. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-099 — HOCs #99
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
87. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-100 — HOCs #100
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
100. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-101 — HOCs #101
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
113. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-102 — HOCs #102
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
126. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-103 — HOCs #103
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
139. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-104 — HOCs #104
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
152. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-105 — HOCs #105
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
165. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-106 — HOCs #106
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
178. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-107 — HOCs #107
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
191. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-108 — HOCs #108
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
4. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-109 — HOCs #109
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
17. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-110 — HOCs #110
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
30. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-111 — HOCs #111
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
43. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-112 — HOCs #112
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
56. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-113 — HOCs #113
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
69. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-114 — HOCs #114
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
82. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-115 — HOCs #115
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
95. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-116 — HOCs #116
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
108. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-117 — HOCs #117
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
121. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-118 — HOCs #118
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
134. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-119 — HOCs #119
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
147. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-120 — HOCs #120
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
160. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-121 — HOCs #121
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
173. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-122 — HOCs #122
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
186. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-123 — HOCs #123
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
199. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-124 — HOCs #124
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
12. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-125 — HOCs #125
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
25. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-126 — HOCs #126
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
38. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-127 — HOCs #127
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
51. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-128 — HOCs #128
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
64. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-129 — HOCs #129
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
77. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-130 — HOCs #130
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
90. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-131 — HOCs #131
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
103. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-132 — HOCs #132
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
116. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-133 — HOCs #133
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
129. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-134 — HOCs #134
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
142. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-135 — HOCs #135
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
155. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-136 — HOCs #136
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
168. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-137 — HOCs #137
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
181. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-138 — HOCs #138
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
194. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-139 — HOCs #139
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
7. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-140 — HOCs #140
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
20. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-141 — HOCs #141
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
33. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-142 — HOCs #142
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
46. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-143 — HOCs #143
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
59. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-144 — HOCs #144
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
72. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-145 — HOCs #145
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
85. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-146 — HOCs #146
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
98. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-147 — HOCs #147
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
111. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-148 — HOCs #148
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
124. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-149 — HOCs #149
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
137. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-150 — HOCs #150
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
150. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-151 — HOCs #151
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
163. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-152 — HOCs #152
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
176. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-153 — HOCs #153
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
189. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-154 — HOCs #154
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
2. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-155 — HOCs #155
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
15. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-156 — HOCs #156
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
28. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-157 — HOCs #157
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
41. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-158 — HOCs #158
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
54. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-159 — HOCs #159
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
67. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-160 — HOCs #160
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
80. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-161 — HOCs #161
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
93. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC injects props that collide with consumer prop names.
- Primary remediation: Wrap with
forwardRefwhen consumers need DOM refs. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-162 — HOCs #162
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
106. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Same HOC applied twice duplicates subscriptions (e.g., double analytics).
- Primary remediation: Replace HOC tower with single provider + hooks where feasible.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-163 — HOCs #163
- Level: Beginner
- Symptom: confusing devtools component names or ref warnings after refactor
119. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC tries to read refs from inner component without forwardRef.
- Primary remediation: Namespace injected props (
injectedX) or use render props / hooks instead. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-164 — HOCs #164
- Level: Beginner+
- Symptom: confusing devtools component names or ref warnings after refactor
132. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Static hoisting breaks when mixing class and function components incorrectly.
- Primary remediation: Avoid deep HOC pyramids; flatten to one wrapper or hooks + context.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-165 — HOCs #165
- Level: Intermediate
- Symptom: confusing devtools component names or ref warnings after refactor
145. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Anonymous wrapped components break React DevTools tree readability.
- Primary remediation: Prefer
useAuth()hook for new code; keep HOC for legacy integration layers. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-166 — HOCs #166
- Level: Intermediate+
- Symptom: confusing devtools component names or ref warnings after refactor
158. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: Multiple contexts inside nested HOCs cause provider hell.
- Primary remediation: Make HOC idempotent or guard subscriptions with singleton module pattern.
- Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-167 — HOCs #167
- Level: Advanced
- Symptom: confusing devtools component names or ref warnings after refactor
171. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC used where a custom hook would be clearer and tree-shake friendlier.
- Primary remediation: Set
displayNamefor wrapped component:WithAuth.displayName = .... - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.
RP0-168 — HOCs #168
- Level: Advanced+
- Symptom: confusing devtools component names or ref warnings after refactor
184. - API symptom: consumers cannot access the right state without importing internals.
- Root cause class: HOC stack order wrong so props get shadowed or ref not forwarded.
- Primary remediation: Document composition order; use
compose()helper; forward refs explicitly. - Verify: unit tests + Storybook variants + a11y keyboard path unchanged.
- Interview one-liner: An HOC is a function that takes a component and returns a component—composition, not inheritance.