mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 02:17:03 -04:00
Add webpack find testing (#2016)
Co-authored-by: V <vendicated@riseup.net> Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
This commit is contained in:
parent
3e8e106be7
commit
534565db25
15 changed files with 289 additions and 97 deletions
|
@ -16,8 +16,12 @@ const NoopComponent = () => null;
|
|||
*/
|
||||
export function LazyComponent<T extends object = any>(factory: () => React.ComponentType<T>, attempts = 5) {
|
||||
const get = makeLazy(factory, attempts);
|
||||
return (props: T) => {
|
||||
const LazyComponent = (props: T) => {
|
||||
const Component = get() ?? NoopComponent;
|
||||
return <Component {...props} />;
|
||||
};
|
||||
|
||||
LazyComponent.$$get = get;
|
||||
|
||||
return LazyComponent;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue