Nothing is showing up on the React-bootstrap application

I am currently working on creating a Navbar using react-bootstrap, but my app is not rendering anything at all. The Navbar is placed in a separate component and I also have some CSS styling in a separate file. However, the only thing displaying in the app is the background color. What could be causing this issue?

Below is the code for my react-bootstrap component:


import Container from 'react-bootstrap/Container'
import Nav from 'react-bootstrap/Nav'
import Navbar from 'react-bootstrap/Navbar'
import {
BrowserRouter as Router,
Routes, Route, Link
} from "react-router-dom"
import '../css/styles.css'

const Header = ({user}) => {

    const padding = {
        padding: 5
      }

    return (
        <Navbar className='nav' bg="light" expand="lg">
          <Container>
            <Navbar.Brand href="#home">Nerdr</Navbar.Brand>
            <Navbar.Toggle aria-controls="basic-navbar-nav" />
            <Navbar.Collapse id="basic-navbar-nav">
              <Nav className="mr-auto">
                <Nav.Link href="#" as="span">
                  {user
                    ? <em>{user} logged in</em>
                    : <Link to="/login">login</Link>
                  }
                </Nav.Link>
              </Nav>
            </Navbar.Collapse>
          </Container>
        </Navbar>
      )  
}

export default Header

Here is the snippet from my CSS file:


body {
...
...

.btn-add:hover {
  background-color: #2980b9;
}

.btn-remove,
.btn-reset {
  padding: 12px 18px;
  margin: 12px auto 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background-color: #3498db;
  border-radius: 4px;
}

.btn-remove:hover,
.btn-reset:hover {
  background-color: #2980b9;
}

.btn-reset {
  margin: 21px auto 0;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for managing responsive font sizes as screen size decreases

Hey there, I could really use some assistance with a new website I've been working on. While I have experience building Joomla sites for the past 6 months, this is my first attempt at making a responsive site using media queries. You can check out th ...

Revamp React Native Images

Managing images can be easy with just two buttons for navigation. However, if you have six images to handle, it may pose a challenge. https://i.sstatic.net/rrDYl.png ss2 ss3 ...

Executing getServerSideProps twice and returning an object during the second invocation

I encountered a problem with my next.js app. It seems that one of the pages is making two calls to getServerSideProps, and on the second call, it returns a string value of "[object Object]", causing an error when the page attempts to load. This issue rece ...

What is the best way to implement a proxy in a React build?

this is the specific api request I need to make http://localhost:3000/api/getUserName however, I am using a proxy in my package.json. After attempting to build the application, the call now goes to http://localhost:5000/api/getUserName Since I am ...

"Is it possible to include a button for horizontal scrolling in the table

I have a bootstrap table with overflowing set to auto within its container, along with a locked first column. While a horizontal scroll bar allows for viewing additional data, I am looking to incorporate buttons for navigation as well. Users should have th ...

Webpack is refusing to compile my code after attempting to import a mongoose model

I've been working on a React blog app that utilizes MongoDB to store posts. However, I encountered an issue where webpack fails to compile when attempting to import a Mongoose model into my NewPost component. Below are the errors I'm facing: W ...

What is the best solution for adjusting spacing in justified text columns within bootstrap?

As I work on creating a div with two columns, I am facing an issue with maintaining justified alignment. It looks great with two divs using col-lg6- in Bootstrap, but when I switch to col-md-6 or col-sm-6, there are excessive spaces between words to keep t ...

Using Typescript to mount an enzyme wrapper component

After noticing that I was repeatedly using a test helper function for an expect statement, I decided to create the following function: const exampleHelper = (wrapper: Type): void => { return expect( wrapper .find('[data-test="examp ...

The primary division containing two inner divisions, one centered and the other positioned to the right

I would like the layout to resemble the image provided. The div header contains two nested divs - the logo div should be centered, and the info div should be positioned to the right with some margin. ...

Does the media query max-width refer to the size of the viewport or the size of the window?

Can someone clarify whether the max-width in a media query is based on the viewport size or window size? For instance, consider this media query: @media screen and (max-width: 360px){} Would this media query be activated when the viewport reaches 360px ...

How can I display only the initial image using php?

I need to hide all images except the first one. I do not want to use a SELECT query with LIMIT 0,1 every time. How can I select all images but display only the first one? Currently, I am using the Photoswipe plugin - you can find more information here. Th ...

When inserting a child element before the myArray.map(x => ) function, it results in rendering only a single child element from the array

Sorry for the confusion in my explanation, but I'm encountering an issue with displaying elements from an array. Here is the code snippet I am working on. Currently, the myArray contains 10 elements. When I place the <LeadingChild/> component ...

Ways to move an element beyond specified padding using CSS

In this image below, I have added a 10px padding to the container as it is usually needed. However, for the headings (blue) I do not want any padding. Is there a way to make the heading extend over the padding? https://i.sstatic.net/DeSHZ.jpg I prefer no ...

Error: Attempting to access 'props' property of undefined when clicking on a button within a React application leads to a TypeError

I'm currently working on implementing two buttons that will enable navigation to different pages within my React app. However, I encountered an error when attempting to use the button labeled "home." TypeError: Cannot read properties of undefined (rea ...

Enhance CSS delivery for the items listed below

Reduce the delay caused by rendering JavaScript and CSS above-the-fold. There are 16 CSS resources currently blocking the rendering of your page. This delay could be affecting the loading time of your content. To improve this issue, consider deferring or ...

Tips for adjusting webpage layout automatically based on window dimensions?

As someone who is new to web development, I am in search of a simple solution that allows my developing page to dynamically resize according to the window size without disrupting the layout. Additionally, I am trying to center the page, but experiencing is ...

Caution: The reutilization of this artificial event is causing an issue with the JSON.stringify function for performance

I have a pop-up window where I need to showcase the following JSON data. { "id": 8, "accountId": 2844, "tagName": null, "mediaType": "xx", "disguise": true, "inserted": "2020-01-31T09:48:38.763", "status": "Failed", "started": "2020-01-31T14:26:17.16", "c ...

Typescript generates a warning when utilizing JSON objects in conjunction with data types

Attempting to access the attributes of a JSON object within a hook using bracket notation. Although it seems to be functioning correctly, TypeScript continues to throw this warning: Property 'github' does not exist on type 'PropertyValues& ...

Issue encountered when using Material-UI Button's onClick() function: "Uncaught TypeError: Unable to access 'name' property of undefined" error is thrown

I have been facing an issue with a Material UI button that has an OnClick function. Strangely, when I try to click on the button, it doesn't seem to work and instead shows an error message. Could anyone please point out what might be going wrong here ...

Can an <option> element in WebKit be customized by adding an icon to it?

I have integrated a WebView into one of my software applications, and within the HTML page it is rendering, there is a <select> tag. I am interested in enhancing the <option> elements within this select tag by adding icons to them: (The shadow ...