This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
import React from 'react';
import Loadable from 'react-loadable';
import Loading from './Loading';
const HeaderExample = Loadable({
loader: () => import(/* webpackChunkName: "header" */'./Header'),
loading: Loading,
});
const ContentExample = Loadable({
loader: () => import(/* webpackChunkName: "content" */'./Content'),
loading: Loading,
});
const MultilevelExample = Loadable({
loader: () => import(/* webpackChunkName: "multilevel" */'./multilevel/Multilevel'),
loading: Loading,
});
export default function App() {
return (
<React.Fragment>
<HeaderExample />
<ContentExample />
<MultilevelExample />
</React.Fragment>
)
}

View File

@@ -0,0 +1,22 @@
import React from 'react';
import Loadable from "react-loadable";
import Loading from "./Loading";
const ContentNestedExample = Loadable({
loader: () => import(/* webpackChunkName: "content-nested" */'./ContentNested'),
loading: Loading,
});
export default function Content() {
return (
<div>
Bacon ipsum dolor amet pork belly minim pork loin reprehenderit incididunt aliquip hamburger chuck culpa mollit officia nisi pig duis.
Buffalo laboris duis ullamco flank.
Consectetur in excepteur elit ut aute adipisicing et tongue veniam labore dolore exercitation.
Swine consectetur boudin landjaeger, t-bone pork belly laborum.
Bacon ex ham ribeye sirloin et venison pariatur dolor non fugiat consequat.
Velit kevin non, jerky alcatra flank ball tip.
<ContentNestedExample />
</div>
);
}

View File

@@ -0,0 +1,10 @@
import React from 'react';
export default function Content() {
return (
<React.Fragment>
<hr />
Eu prosciutto fugiat, meatloaf beef ribs jerky dolore commodo est chicken t-bone meatball capicola magna ipsum. Ribeye shankle mollit venison.
</React.Fragment>
);
}

View File

@@ -0,0 +1,9 @@
import React from 'react';
export default function Header() {
return (
<div>
<h1>React Loadable SSR Add-on</h1>
</div>
);
}

View File

@@ -0,0 +1,15 @@
import React from 'react';
export default function Loading(props) {
if (props.isLoading) {
if (props.timedOut) {
return <div>Loader timed out!</div>;
} else if (props.pastDelay) {
return <div>Loading...</div>;
}
return null;
} else if (props.error) {
return <div>Error! Component failed to load</div>;
}
return null;
}

View File

@@ -0,0 +1,26 @@
import React from 'react';
import Loadable from "react-loadable";
import Loading from "../Loading";
const SharedMultilevelExample = Loadable({
loader: () => import(/* webpackChunkName: "shared-multilevel" */'./SharedMultilevel'),
loading: Loading,
});
const DeeplevelExample = Loadable({
loader: () => import(/* webpackChunkName: "deeplevel" */'./level-1/level-2/DeepLevel'),
loading: Loading,
});
export default function Multilevel() {
return (
<div>
<hr />
Multilevel with Shared Component Example.
<SharedMultilevelExample />
Loading from a DeepLevel
<DeeplevelExample />
<hr />
</div>
);
}

View File

@@ -0,0 +1,13 @@
import React from 'react';
/* eslint-disable react/jsx-one-expression-per-line */
export default function SharedMultilevel() {
return (
<ul>
<li>
this is a <strong>shared multilevel</strong> component
</li>
</ul>
);
}
/* eslint-enable react/jsx-one-expression-per-line */

View File

@@ -0,0 +1,16 @@
import React from 'react';
import Loadable from "react-loadable";
import Loading from "../../../Loading";
const SharedMultilevelExample = Loadable({
loader: () => import(/* webpackChunkName: "shared-multilevel" */'../../SharedMultilevel'),
loading: Loading,
});
export default function DeepLevel() {
return (
<div>
<SharedMultilevelExample />
</div>
);
}