Skip to content

Bug: Nested components imported with React.lazy cause rerendering #27573

Closed as not planned
@troovi

Description

@troovi

if we nest a component imported with React.lazy inside component that is also imported using React.lazy, we will get a re-render of that chain's child. I don't think this behavior is normal

React version: 18.2.0

Steps To Reproduce:

  1. Create some component "A"
  2. Import component "A" into component "B" via React.lazy and wrap it in Suspense
  3. Import component "B" into Component "C" via React.lazy and wrap it in Suspense
  4. Import component "C" into root component (App)

result:

Снимок экрана 2023-10-24 в 20 17 27


Codesandbox link:

https://codesandbox.io/s/react-lazy-rerender-bug-h8ynhr
(check console messages)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions