colocation

Keeping files that belong together, such as a page, its components and its tests, in the same folder.

In more detail

Colocated files are easy to find, change and delete together. The opposite is grouping by type, such as all components in one folder, far from where they are used.

Example

In the App Router a folder only becomes public when it has a page or route file, so colocated helpers are safe.

Related terms

Taught in

References