Encountering a problem with the navigation bar in the latest version of Next.js, version 13

"use client"
import {Navbar, Button, Link, Text} from "@nextui-org/react";
import {styled} from "@nextui-org/react"

const Box = styled("div", {
    boxSizing: "border-box",
});

const AcmeLogo = () => (
    <svg
        className=""
        fill="none"
        height="36"
        viewBox="0 0 32 32"
        width="36"
        xmlns="http://www.w3.org/2000/svg"
    >
        <rect fill="var(--secondary)" height="100%" rx="16" width="100%"/>
        <path
            clipRule="evenodd"
            d="M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z"
            fill="currentColor"
            fillRule="evenodd"
        />
    </svg>
);

export const MyNavbar = () => {
    return (
        <Box css={{
            maxW: "100%"
        }}>
            <Navbar isBordered variant="floating">
                <Navbar.Brand>
                    <AcmeLogo/>
                    <Text b color="inherit" hideIn="xs">
                        ACME
                    </Text>
                </Navbar.Brand>
                <Navbar.Content hideIn="xs" variant="highlight-rounded">
                    <Navbar.Link href="#">Features</Navbar.Link>
                    <Navbar.Link isActive href="#">Customers</Navbar.Link>
                    <Navbar.Link href="#">Pricing</Navbar.Link>
                    <Navbar.Link href="#">Company</Navbar.Link>
                </Navbar.Content>
                <Navbar.Content>
                    <Navbar.Link color="inherit" href="#">
                        Login
                    </Navbar.Link>
                    <Navbar.Item>
                        <Button auto flat as={Link} href="#">
                            Sign Up
                        </Button>
                    </Navbar.Item>
                </Navbar.Content>
            </Navbar>
        </Box>
    );
}

This component represents the navbar in my project.

"use client";

import * as React from "react";
import {NextUIProvider} from "@nextui-org/react";


export function Providers({children}) {
    return (
        <NextUIProvider>
            {children}
        </NextUIProvider>
    );
}

This component sets up the providers for the app.

import './globals.css'
import {Inter} from 'next/font/google'
import {MyNavbar} from "@/components/navbar";
import {Providers} from "@/app/provider";

const inter = Inter({subsets: ['latin']})


export const metadata = {
    title: 'Create Next App',
    description: 'Generated by create next app',
}

export default function RootLayout({children}) {
    return (
        <html lang="en">
        <body className={inter.className}>
        <Providers>
            <MyNavbar/>
            {children}
        </Providers>
        </body>
        </html>
    )
}

This layout includes the global styles and components for the app.

Upon first opening the website, it appeared like this. [enter image description here]

After some adjustments, the website transformed into this. (https://i.stack.imgur.com/hLuXL.png)

If you are facing issues with rendering, make sure to enable CSS from the beginning.

Answer №1

Consider a potential resolution by eliminating the metadata and inter.classname attributes within the layout.js file, while also introducing the "use client" directive at the beginning of the file. This adjustment has the potential to address the problem at hand.

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

The problem I am facing is with the React Ant d Modal Component, where I am unable to render the

Hey there! I'm currently working with React Js and the 'Ant design Modal Component'. When I click on a button, the modal should open and display the content of each user with their unique ID. However, I'm facing an issue where all modal ...

Customizing reusable components in React: Changing background and border colors

In my current project using React, I have a Parent component called App.js, and within that, there is a Child Component named Child.js. Within App.js, I have included the Child.js component twice. As a result, two circles are displayed due to some CSS sty ...

Having trouble accessing my account due to authentication issues

Exploring the realms of next-auth and prisma is an exciting journey for me as a newcomer. As I ventured into integrating them for authentication on a website, everything seemed to function seamlessly in development mode. However, upon attempting to sign in ...

When opening the menu, the focus of Material UI input is lost, causing

I am currently working on an input field that should open a menu when it is focused. The issue I am facing is that while the menu opens correctly, the input field loses focus and all of its custom styling when the menu is visible. Does anyone have any sugg ...

How to Retrieve the Default Value in a React Hook?

I have a certain input field with a default value assigned to it. <input type="text" name="default" value="one" /> To handle the state of this input, I am utilizing a react hook. const [def, setdef] = useState({Defaul ...

What are the steps to seamlessly embed Rocket.chat Omnichannel livechat into an iframe without the open/close button?

I am looking to add a live chat feature in an iframe on my website without the open/close button, only utilizing the onichannel chat layout. I attempted something like the following: 'use client'; import React from 'react'; export con ...

Experiencing difficulties while trying to showcase a PDF within the Expo Go app

I am currently developing a React Native application that requires the display of PDF files. I have tried two different methods, one using react-native-webview and the other with react-native-pdf, but both approaches are presenting challenges. This is how ...

Achieve full height without scrolling in React

I am facing an issue where the height:100% property is not working to fill the remaining area on the screen. A red outlined area represents the border radius, while the highlighted yellow space should have been filled: https://i.stack.imgur.com/ZQNkw.png ...

The sticky HTML table header feature is functional, however, the header's border disappears while scrolling

Utilizing the react-bootstrap-table2 library in my React project, I added custom CSS to create a sticky top row effect: .table-container { overflow-y: auto; max-height: 500px; } .react-bootstrap-table th { position: sticky; top: -1px; background- ...

react: implement custom context menu on videojs

Can someone assist me with adding a quality selector and disabling the right-click option in a webpage that uses videojs? I am unsure about using plugins, as there were no examples provided in react. Any guidance would be appreciated. VideoPlayer.js impor ...

Menu icon in Next.js/React/Tailwind not triggering close action when clicked again, causing responsiveness issue

Hey there, I'm relatively new to working with Next.js and React. Right now, I'm tackling the challenge of creating a responsive navbar that toggles open and closed when clicking on the hamburger icon (and should also close when clicked outside th ...

Shattering the barrier

When using the bubble chart, I encountered an issue with adding line breaks in text. No matter what I tried, such as using \n or , it consistently showed me an error. import React from 'react'; import { BubbleChart,key,data } from 're ...

Using Strapi and Next.js to retrieve user information

After searching for similar questions with no luck, I'm reaching out for help. Building an authentication system using Strapi and Next.js, I'm faced with a task that seems simple but eludes me. The main question is: How can the client retrieve u ...

Wildcard routes in Express can't locate routes that have the symbol `?`

As a newcomer to Express, I am encountering an issue with my simple React SSR application. It functions properly for exact match routes (/about, /cv, /contact), but fails for paths with query strings, even if it's just ? at the end. For example, /cv? ...

What is the proper way to enable the Google Analytics cookie only once another consent cookie has been set and is marked as "true"?

I am currently using React/Nextjs on my website along with the react-cookie-consent library. This setup generates a pop-up where users can agree to the cookie policy, and if they do, a CookieConsent with the value "true" is set. In addition to this, I wis ...

encountering an issue with server-side rendering of React causing an error

Node.js has been a bit of a challenge for me, especially when it comes to working with react and express. I have been struggling to find comprehensive tutorials and troubleshooting resources, leading me to ask minimal questions in the correct manner. While ...

How can I transform Material UI pure ReactJS functions into ES6 classes?

I have integrated React Material UI into my application and encountered some missing logic in my React code. The code provided below is functioning correctly. import React from 'react'; import { fade,makeStyles } from '@material-ui/core/sty ...

What is the process for creating a linked TreeNode in the Ant tree design?

After completing a tree design utilizing Ant Design, I encountered an issue where certain nodes within the tree needed to act as links. Despite my attempts to directly assign links, they were not functioning properly. array.map((node) => { if(node.t ...

Incorporate the React modal component into your project

Having recently started with react, I decided to create a react modal component that displays an image along with a close button. const BoxModal = ({children, modalIsOpen, setModalIsOpen}) => { return ( <> <Modal isOpen={mod ...

What is the appropriate way to retrieve an array that has been stored in the this.state property?

https://i.stack.imgur.com/y9huN.jpgAs a newcomer to react, I have been exploring the react documentation on making Ajax calls. While the docs make it seem simple to retrieve JSON information and set it to a state variable, I've encountered some challe ...