search

Home  >  Q&A  >  body text

What's causing my React sidebar to jitter whenever a new page loads?

For context, I'm using the React-Bootstrap library. Whenever I click on the href in the code, the sidebar jitters for half a second, almost like it resets to its unstyled state and then returns to its normal form. Does anyone know why this is happening? Is it because my code is too slow? Here is my sidebar code:

import React from "react";
import "../../App.css";
import { Nav, Navbar } from "react-bootstrap";
import ProfileSection from "./ProfileSection";
import ContactBar from "./ContactBar";
import HomeItem from "./SidebarItems/HomeItem";
import BlogItem from "./SidebarItems/BlogItem";
import WorkItem from "./SidebarItems/ProjectItem";
import PhilItem from "./SidebarItems/PhilItem";
import { Container } from "@mui/system";

function Sidebar() {
    return (
        <Navbar expand="lg">
            <Container>
                <Navbar.Toggle aria-controls="responsive-navbar-nav" />
                <Navbar.Collapse id="responsive-navbar-nav">
                    <Nav defaultActiveKey="/" className="flex-column">
                        <ProfileSection />
                        <HomeItem />
                        <BlogItem />
                        <WorkItem />
                        <PhilItem />
                        <ContactBar />
                    </Nav>
                </Navbar.Collapse>
            </Container>
        </Navbar>
    )
};

export default Sidebar;

P粉055726146P粉055726146240 days ago278

reply all(1)I'll reply

  • P粉478445671

    P粉4784456712024-03-22 10:41:43

    Your code works fine on my device.. Must be some internet or device issue. I also checked your code and there is nothing wrong with your code. Once deployed there is no need to worry about it working properly.

    reply
    0
  • Cancelreply