Maintain clean and logical component organization by following these guidelines: 1. Keep related files together - place test files beside their components rather than in separate folders
Maintain clean and logical component organization by following these guidelines:
Example of proper component organization:
// โ
Good: Test file next to component
// components/MyComponent/
// - MyComponent.tsx
// - MyComponent.test.tsx
// โ
Good: Components defined at module level
export const ParentComponent = () => {
return <ChildComponent />
}
export const ChildComponent = () => {
return <div>Child</div>
}
// โ Bad: Component defined within another
const ParentComponent = () => {
const NestedComponent = () => { // Avoid this
return <div>Nested</div>
}
return <NestedComponent />
}
This organization improves code maintainability, reduces coupling, and makes the codebase easier to navigate.
Enter the URL of a public GitHub repository