Rules
no-nested-lazy-component-declarations
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Presets
x
recommended
recommended-typescript
recommended-type-checked
Description
Disallow nesting lazy component declarations inside other components.
When a lazy component is declared inside another component, it will be re-created on every render of the parent component. This can lead to unexpected behavior, such as resetting the state of the lazy component.
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-nested-component-definitions
Disallow nesting component definitions inside other components.