TanStackT
TanStack11mo ago
11 replies
opposite-copper

Extracting components from routes

Hi all, this feels like a noob question, but: what is the standard way in file-based routing to extract a component from my page to it's own file?

I can obviously create a shared app/components/ directory for truly shared components (like Card, Button etc), but how about single use components that only exist on one page?

If I for example create routes/profile/AboutCard.tsx it seems to assume that this is a new route, but I just want it to be a component that my routes/profile/index.tsx can import.

Just wondering basically what the standard file structure for this is, and I've failed to find it by googling or asking the LLM's.

Thanks!
Was this page helpful?