Skip to content

[2.x] Component helper for lazy loading components #4220

@dsevillamartin

Description

@dsevillamartin

Similar to React's <Suspense> (but way less complex), pass a code split component and optionally a custom loader to show while it is being imported.

A simple "just loading" component could be fairly nice for components that don't need to be tightly integrated with the parent, just to avoid a lot of boilerplate loading indicators and stuff. Not necessarily as complicated as the Suspense as that goes deep in the children, but just for a single component.

Something like this (might make sense to do it some other way, but you get the idea)

<LazyComponent
    content={import('...')}>
    This text is shown while loading
</LazyComponent>

I could see this also being useful perhaps to just show a LoadingIndicator when the param loading is true, maybe. But that's not the focus.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions