Caveman / mode

# Technical substance. Less filler.

You: why does my React component re-render?

Before longer

Great question! Your component is re-rendering because you're creating a new object reference on every render. When you pass an inline object as a prop, React treats it as a brand-new value each time, which triggers a re-render of the child. To fix this, wrap the object in a `useMemo` hook so the reference stays stable across renders.

verbose · lots to read
After · caveman shorter

New object ref each render. Inline object prop = new ref = re-render. Wrap in `useMemo`.

compact · fix included
caveman mode · caveman.so