Menu

Seven useMemo calls in 72,683 lines, six of them in one file, and the one that matters is not about speed
📰

Seven useMemo calls in 72,683 lines, six of them in one file, and the one that matters is not about speed

DEV Community: nextjs·Daniel Pertu·8 days ago
#juC1pyd7
#devtonextjs#devto#dev#list#memo
Reading 0:00
15s threshold

Nakodo is a Next.js 16 app on React 19.2.8: 582 TypeScript files, 72,683 lines. Most advice about React performance is about memoisation, so I grepped the whole thing to see how much of it we actually use.

useMemo 7 occurrences, 2 files useCallback 2 occurrences, 2 files React.memo / memo() 0 useDeferredValue 0 useLayoutEffect 0 useImperativeHandle 0

Enter fullscreen mode

Exit fullscreen mode

For scale, the same grep over the same tree finds useEffect in 23 files, useState in 33, useTransition in 11 and useActionState in 11. So the app is not short of client state. It is short of memoisation, and the reason turns out to be structural rather than principled.

Why there is so little to memoise

226 of the files are .tsx . Eighty of them start with "use client" , and 17 of those eighty are the shadcn primitives in src/components/ui . Everything else renders on the server, which includes almost every list in the product: the campaign list, the conversations screen, the creator page, all 76 public pages.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.