|
@@ -5,19 +5,17 @@ import React, { Suspense } from 'react';
|
|
|
* If you throw a Promise in the component, it will display a sppiner
|
|
* If you throw a Promise in the component, it will display a sppiner
|
|
|
* @param {object} Component A React.Component or functional component
|
|
* @param {object} Component A React.Component or functional component
|
|
|
*/
|
|
*/
|
|
|
-export function withLoadingSppiner(Component) {
|
|
|
|
|
- return (props => function getWithLoadingSpinner() {
|
|
|
|
|
- return (
|
|
|
|
|
|
|
+export const withLoadingSppiner = Component => function getWithLoadingSpinner(props) {
|
|
|
|
|
+ return (
|
|
|
// wrap with <Suspense></Suspense>
|
|
// wrap with <Suspense></Suspense>
|
|
|
- <Suspense
|
|
|
|
|
- fallback={(
|
|
|
|
|
- <div className="my-5 text-center">
|
|
|
|
|
- <i className="fa fa-lg fa-spinner fa-pulse mx-auto text-muted"></i>
|
|
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
- >
|
|
|
|
|
- <Component {...props} />
|
|
|
|
|
- </Suspense>
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ <Suspense
|
|
|
|
|
+ fallback={(
|
|
|
|
|
+ <div className="my-5 text-center">
|
|
|
|
|
+ <i className="fa fa-lg fa-spinner fa-pulse mx-auto text-muted"></i>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Component {...props} />
|
|
|
|
|
+ </Suspense>
|
|
|
|
|
+ );
|
|
|
|
|
+};
|