Menu

Nineteen pages behind our login, nineteen loading.tsx files, and 159 uses of a component called Bone
📰

Nineteen pages behind our login, nineteen loading.tsx files, and 159 uses of a component called Bone

DEV Community: react·Daniel Pertu·16 days ago
#tbHcNg7W
#devtoreact#devto#dev#loading#skeleton
Reading 0:00
15s threshold

Nakodo has 19 pages behind its login. It also has 19 loading.tsx files. That is not a coincidence I noticed afterwards, it is a rule, and this is what checking it looks like:

$ for d in $( find "src/app/(app)" -name page.tsx | xargs -n1 dirname ) ; do [ -f " $d /loading.tsx" ] || echo "no loading: $d " done $

Enter fullscreen mode

Exit fullscreen mode

No output. Nineteen for 19. Together they are 885 lines, which is more code than any single page in the app, and the rest of this post is what is in them and the four decisions that shaped them.

The primitive is called Bone, and it is hatched

shadcn's Skeleton is 13 lines and ships with every install:

function Skeleton ({ className , ... props }: React . ComponentProps < " div " > ) { return < div data-slot = "skeleton" className = { cn ( " animate-pulse rounded-md bg-muted " , className ) } { ...…

Continue reading — create a free account

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