Menu

Two of our 1,029 page files are client components, and two pages 23 KB apart in HTML ship byte-identical JavaScript
📰

Two of our 1,029 page files are client components, and two pages 23 KB apart in HTML ship byte-identical JavaScript

DEV Community: nextjs·Daniel Pertu·about 22 hours ago
#xsWeS1RN
#devtonextjs#devto#dev#server#client
Reading 0:00
15s threshold

I counted every 'use client' in this repository, expecting the answer to be "most of them" and to feel bad about it.

directory files 'use client'

components/ 1,062 586

lib/ 1,407 75

app/ 1,148 11

__tests__/ 507 0

scripts/ 18 0

total 4,142 672

16 percent, which is unremarkable. The number that is not unremarkable is in the app/ row. This site has 1,029 page.tsx files, and exactly two of them are client components.

Both are behind the login, and both are a screen that builds its view in the browser out of a single fetch rather than rendering it on the server. Every other page in the repository, including the 991 public ones, is a server component.

What that buys, measured from outside

Two employer guides. One is a 130-line page file, the other 410 lines, and the rendered difference is about 23 KB of HTML.…

Continue reading — create a free account

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