Choose variable, component, and parameter names that clearly describe their purpose and avoid ambiguity. Names should fully reflect functionality, be properly spelled, and avoid confusion with library terms or similar concepts.
Choose variable, component, and parameter names that clearly describe their purpose and avoid ambiguity. Names should fully reflect functionality, be properly spelled, and avoid confusion with library terms or similar concepts.
Good identifiers:
ProtectedSchemaWarning
instead of Alert_Shadcn_
)isHealthy
instead of isSuccess
when not related to API request status)BillingCustomerDataDialog
instead of BillingAddressDialog
when handling both address and tax ID)referral
not referal
)Example:
// Unclear naming, potential confusion with React Query
const StatusMessage = ({ isSuccess, status }) => {
if (isSuccess) return 'Healthy'
// ...
}
// Clear, descriptive naming that avoids ambiguity
const StatusMessage = ({ isHealthy, status }) => {
if (isHealthy) return 'Healthy'
// ...
}
Clear naming significantly improves code readability, maintainability, and reduces the cognitive load for developers who need to understand the code.
Enter the URL of a public GitHub repository