Feedback

Basic information

Repository
TheOrcDev
Skill
rerender-memo

About rerender-memo

Extract expensive work into memoized components with React.memo. Apply when components perform expensive computations that can be skipped when props haven't changed.

rerender-memo is an agent skill listed in the AddMCP.net directory, published by TheOrcDev. Runtime: TypeScript. License: MIT. The repository has 2,061 GitHub stars. Source code is hosted on github.com. Related topics: 8-bit, components, retro, shadcn, ui.

Overview

What is rerender-memo?


name: rerender-memo description: Extract expensive work into memoized components with React.memo. Apply when components perform expensive computations that can be skipped when props haven't changed.


Extract to Memoized Components

Extract expensive work into memoized components to enable early returns before computation. **Incorrect (computes avatar even when loading):** ```tsx function Profile({ user, loading }: Props) { const avatar = useMemo(() => { const id = computeAvatarId(user) return }, [user]) if (loading) return return
{avatar}
} ``` **Correct (skips computation when loading):** ```tsx const UserAvatar = memo(function UserAvatar({ user }: { user: User }) { const id = useMemo(() => computeAvatarId(user), [user]) return }) function Profile({ user, loading }: Props) { if (loading) return return (
) } ``` **Note:** If your project has [React Compiler](https://react.dev/learn/react-compiler) enabled, manual memoization with `memo()` and `useMemo()` is not necessary. The compiler automatically optimizes re-renders.

Comments

No comments yet

Be the first to share feedback about this listing. Sign in to leave a comment.

Sign In

Feedback 💬