Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented code splitting #260

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
import React from 'react';
import React, { lazy, Suspense } from 'react';
import './App.css';
// import axios from 'axios'
import HomePage from './Components/HomePage/HomePage';
import SocialIcons from "./Components/SocialIcons/SocialIcons"
import PostOpportunity from './Components/PostOpportunity/PostOpportunity';
import FullTimeForm from './Components/PostOpportunity/sections/FullTime/FullTime';
import InternshipForm from './Components/PostOpportunity/sections/Internships/Internships';
import TechConfForm from './Components/PostOpportunity/sections/TechConf/TechConf';
import HackathonForm from './Components/PostOpportunity/sections/Hackathons/Hackathons';
import CodingCompForm from './Components/PostOpportunity/sections/CodingComp/CodingComp';
import ScholarshipForm from './Components/PostOpportunity/sections/Scholarships/Scholarships';
import ScrollTop from './Components/ScrollTop/ScrollTop';
import { ViewOpportunity } from './Components/ViewOpportunity/';
import Footer from './Components/Footer/Footer';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
import SignUp from './Components/SignupLogin/SignUp';
import Login from './Components/SignupLogin/Login';
import PageNotFound from './Components/Error/PageNotFound';
import Forget from './Components/Forget/Forget';
// import HomePage from './Components/HomePage/HomePage';
// import SocialIcons from "./Components/SocialIcons/SocialIcons"
// import PostOpportunity from './Components/PostOpportunity/PostOpportunity';
// import FullTimeForm from './Components/PostOpportunity/sections/FullTime/FullTime';
// import InternshipForm from './Components/PostOpportunity/sections/Internships/Internships';
// import TechConfForm from './Components/PostOpportunity/sections/TechConf/TechConf';
// import HackathonForm from './Components/PostOpportunity/sections/Hackathons/Hackathons';
// import CodingCompForm from './Components/PostOpportunity/sections/CodingComp/CodingComp';
// import ScholarshipForm from './Components/PostOpportunity/sections/Scholarships/Scholarships';
// import ScrollTop from './Components/ScrollTop/ScrollTop';
// import ViewOpportunity from './Components/ViewOpportunity/';
// import Footer from './Components/Footer/Footer';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
// import SignUp from './Components/SignupLogin/SignUp';
// import Login from './Components/SignupLogin/Login';
// import PageNotFound from './Components/Error/PageNotFound';
// import Forget from './Components/Forget/Forget';

// const Home = React.lazy(() => {
// return new Promise(resolve => {
// setTimeout(() => resolve(import('./components/home')), 4000);
// });
// });

const HomePage = lazy( () => import('./Components/HomePage/HomePage'));
const SocialIcons = lazy( () => import("./Components/SocialIcons/SocialIcons"));
const Footer = lazy( () => import('./Components/Footer/Footer'));
const Forget = lazy( () => import('./Components/Forget/Forget'));
const PageNotFound = lazy( () => import('./Components/Error/PageNotFound'));
const Login = lazy( () => import('./Components/SignupLogin/Login'));
const SignUp = lazy( () => import('./Components/SignupLogin/SignUp'));
const ScholarshipForm = lazy( () => import('./Components/PostOpportunity/sections/Scholarships/Scholarships'));
const CodingCompForm = lazy( () => import('./Components/PostOpportunity/sections/CodingComp/CodingComp'));
const HackathonForm = lazy( () => import('./Components/PostOpportunity/sections/Hackathons/Hackathons'));
const TechConfForm = lazy( () => import('./Components/PostOpportunity/sections/TechConf/TechConf'));
const InternshipForm = lazy( () => import('./Components/PostOpportunity/sections/Internships/Internships'));
const FullTimeForm = lazy( () => import('./Components/PostOpportunity/sections/FullTime/FullTime'));
const PostOpportunity = lazy( () => import('./Components/PostOpportunity/PostOpportunity'));
const ViewOpportunity = lazy( () => import('./Components/ViewOpportunity/'));
const ScrollTop = lazy( () => import('./Components/ScrollTop/ScrollTop'));
// const ScrollTop = lazy( () => import('./Components/ScrollTop/ScrollTop'));


function App() {
return (
<Router>
<div className="App">
<Suspense fallback={<div style={{ display: 'flex', justifyContent: 'center', marginTop:'50px'}}>Loading...</div>}>
<Switch >
<Route
exact
Expand Down Expand Up @@ -175,8 +201,11 @@ function App() {
)}
/>
</Switch>
</Suspense>
<Suspense fallback={<div style={{ display: 'flex', justifyContent: 'center', marginTop:'50px'}}></div>}>
<ScrollTop />
<Footer />
</Suspense>
</div>
</Router>
);
Expand Down