This product is not supported for your selected Datadog site. ().
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다. 현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.
Metadata
ID:tsx-react/no-nested-components
Language: TypeScript
Severity: Warning
Category: Best Practices
Description
In TypeScript, particularly when using React, it’s important to avoid nesting components inside other components. Components are meant to be reusable, independent, and encapsulated.
When components are nested, it could lead to unnecessary re-rendering and performance degradation, as the nested component is re-created every time the parent component renders.
To avoid this, define your components at the top level of your module and then use them inside other components by referencing their names. This way, the components are only created once and reused, leading to better performance and easier code management.