flarum / flarum/framework

[2.x] Component helper for lazy loading components

Open
#4,220 0 comments 2 reactions 0 assignees View on GitHub
type/extensibility
Dominant language
PHP
Stars
6.7k
Forks
883
Avg merge
15h 16m
Merged PRs (30d)
73

Description

Similar to React's `` (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)
```js

This text is shown while loading

```

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.