| name | Component Lifecycle Manager |
| version | 1.0.0 |
| description | Manages component lifecycle from creation to destruction. Handles initialization, mounting, updating, and cleanup patterns across React, Vue, and vanilla JS. |
| author | workspace |
| activated | false |
Component Lifecycle Manager
Manages component lifecycle from creation to destruction. Handles initialization, mounting, updating, and cleanup patterns across React, Vue, and vanilla JS.
Decision Framework
When to Apply
Use when: Complex components with side effects, subscriptions, timers, or external resources requiring cleanup
When NOT to Apply
Don't use when: Simple stateless presentational components
Anti-Patterns
1. Memory Leaks
componentDidMount() {
window.addEventListener('resize', this.handleResize);
}
componentWillUnmount() {
window.removeEventListener('resize', this.handleResize);
}
2. Unnecessary Re-renders
<Component style={{ color: 'red' }} onClick={() => doSomething()} />
const style = useMemo(() => ({ color: 'red' }), []);
const handleClick = useCallback(() => doSomething(), []);
Trigger Phrases
- "Component lifecycle"
- "Mount/unmount"
- "useEffect cleanup"
- "Memory leak"
- "Re-render optimization"
Patterns
Effect Lifecycle (React)
useEffect(() => {
const controller = new AbortController();
fetchData(controller.signal);
return () => controller.abort();
}, [dependency]);
Mount/Unmount Hooks
function useMountUnmount(onMount, onUnmount) {
useEffect(() => {
onMount?.();
return () => onUnmount?.();
}, []);
}
Integration
- Works with: state-machine-designer, performance-budget-enforcer