Immediately showing website Home page before the preloader page render

I have created a website from React. recently I have implemented a preloader page for my website. But the issue is immediately showing website Home page before that preloader page render. How I fix this issue? showing below loader component and app.js file. I’m using Lottie package for Loader component.

Loader component

import React from "react"
import Lottie from "react-lottie"
import * as loading from "../../assets/paperplane.json"
import "./Loader.css"

const defaultOptions = {
  loop: true,
  autoplay: true,
  animationData: loading.default,
  rendererSettings: {
    preserveAspectRatio: "xMidYMid slice",

const Loader = () => {
  return (
    <div className="loader">
      <div className="active">
        <Lottie options={defaultOptions} height={400} width={400} />

export default Loader


import React, { useState, useEffect } from "react"
import { BrowserRouter, Route, Switch } from "react-router-dom"
import Header from "./components/header/Header"
import Loader from "./components/loader/Loader"
import Home from "./screens/Home/Home"
import Works from "./screens/Works/Works"
import About from "./screens/About/About"
import Contact from "./screens/Contact/Contact"
import WebProjects from "./screens/WebProjects/WebProjects"
import DesignProjects from "./screens/DesignProjects/DesignProjects"

function App() {
  const [loading, setLoading] = useState(false)

  useEffect(() => {
    setTimeout(() => {
    }, 5000)
  }, [])
  return (
      {loading ? (
        <Loader loading={loading} />
      ) : (
          <Header />
              <Route path="/" component={Home} exact />
              <Route path="/about" component={About} />
              <Route path="/works/web-projects" component={WebProjects} />
              <Route path="/works" component={Works} />
              <Route path="/contact" component={Contact} />

export default App

8 thoughts on “Immediately showing website Home page before the preloader page render”

  1. 649593 350998When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove me from that service? Thanks! 393338

  2. 131625 288147Register a domain, search for available domains, renew and transfer domains, and pick from a wide variety of domain extensions. 620418


Leave a Comment