kaori 3 лет назад
Родитель
Сommit
2ca9fa9b6e
1 измененных файлов с 13 добавлено и 15 удалено
  1. 13 15
      packages/app/src/components/SuspenseUtils.jsx

+ 13 - 15
packages/app/src/components/SuspenseUtils.jsx

@@ -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>
+  );
+};