diff --git a/src/App.js b/src/App.js index 85221417..6bb793ee 100644 --- a/src/App.js +++ b/src/App.js @@ -1,12 +1,14 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, Suspense, lazy } from 'react'; import Navbar from './components/Navbar'; import './App.css'; -import Home from './components/Home/Home'; import { Switch, Route, Redirect } from 'react-router-dom'; import Footer from './components/Footer'; -import Resource from './components/Category/Resource'; -import Resources from './components/Category/Resources'; import ScrollToTopBtn from './components/ScrollToTopBtn'; +import Spinner from './components/Spinner'; + +const Home = lazy(() => import('./components/Home/Home')); +const Resource = lazy(() => import('./components/Category/Resource')); +const Resources = lazy(() => import('./components/Category/Resources')); function App() { const [searchInput, setSearchInput] = useState(''); @@ -38,25 +40,27 @@ function App() {
- - - ( - - )} - /> - } - /> - - + }> + + + ( + + )} + /> + } + /> + + +