diff --git a/client/src/components/App.js b/client/src/components/App.js index 15d7feb..19f268f 100644 --- a/client/src/components/App.js +++ b/client/src/components/App.js @@ -7,27 +7,37 @@ import Loadable from 'react-loadable'; import './Container.css'; import './App.css'; +function Loading(props) { + if (props.error) { + return
Error!
; + } else if (props.pastDelay) { + return
Loading...
; + } else { + return null; + } +} + const LoadableTodosView = Loadable({ loader: () => import('./todolist/TodosView'), - loading: () => loading, + loading: () => Loading, delay: 1000, }); const LoadableLoginForm = Loadable({ loader: () => import('./user/LoginForm'), - loading: () => loading, + loading: () => Loading, delay: 1000, }); const LoadableSignupForm = Loadable({ loader: () => import('./user/SignupForm'), - loading: () => loading, + loading: () => Loading, delay: 1000, }); const LoadableEditView = Loadable({ loader: () => import('./user/EditForm'), - loading: () => loading, + loading: () => Loading, delay: 1000, });