Menu

Thirty-three useEffect calls in 72,683 lines, and the same six lines are written out four times
📰

Thirty-three useEffect calls in 72,683 lines, and the same six lines are written out four times

DEV Community: nextjs·Daniel Pertu·2 days ago
#M4UFn8Pb
#devtonextjs#devto#dev#effect#lines
Reading 0:00
15s threshold

I have counted the useMemo calls in this app (seven) and the useState calls in one panel (eighteen). This time it is effects, which are the hook with the worst reputation and the one most likely to tell you what a codebase is actually doing.

Nakodo is 72,683 lines of TypeScript. 80 files carry "use client" . 33 useEffect calls live in 23 of them, so 55 client components have no effect at all.

useEffect 33 calls in 23 files useLayoutEffect 0 useSyncExternalStore 4 useState 69 useTransition 14 useOptimistic 3 useDeferredValue 0

Enter fullscreen mode

Exit fullscreen mode

Two numbers in that list say most of it.…

Continue reading — create a free account

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