react-composable-components
React Composable Components
Patterns for authoring React components that are small, focused, and highly composable.
Core idea
Large components that manage too much state and render multiple distinct UI areas suffer from poor readability, reusability, and render performance.
Avoid: Massive monolithic components that accept dozens of props (hasHeader, showFooter).
Prefer: Breaking UI down into atomic, composable pieces (Compound Components) that transparently pass HTML attributes and merge utility classes for easy customization.
1. Extract Inline Render Methods
If a component has methods like renderStoryScreen(), extract them into independent child components. This prevents unnecessary re-renders of the entire monolith when small parts of the state change.
More from jonmumm/skills
dont-use-use-effect
>
59grill-me
>
32mutation-testing
Run and interpret Stryker mutation testing; kill survivors to reach ≥95% score. Use when running mutation tests, setting up Stryker, interpreting survivors, or verifying test quality after TDD.
32offensive-typesafety
>
31expo-testing
Build, install, and test Expo/React Native apps on simulators and physical devices. Use when asked to "run on simulator", "install on device", "test on phone", "run detox", "preview build", or "build and test".
30react-render-performance
>
29