Relative Content

Tag Archive for javascriptnext.js

Next.js notFound() not setting 404 HTTP Header

The point of choosing Nextjs was for SSR and SEO. We have an external REST API which we query for data on the frontend. But on some pages, we need do a pre-render fetching and display proper 404 Not Found header when API returns 404. This seems to be difficult for me.

cannot read properties of undefind – compaling error

In office I am working on linux, but at home on windows. I copied the repository everything’s the same like in work but I can’t work from home.[enter image description here](https://i.sstatic.net/AfIfsi8J.png)

NextRouter was not mounted when use useRouter hook from next/router

import { useRouter } from ‘next/router’; const Navbar2 = () => { const router = useRouter(); return ( <nav className={`fixed top-0 w-full px-10 bg-white p-4 transition-all duration-500 ${isVisible ? ‘top-0’ : ‘top-[-160px]’}`}> <div className=”flex items-center justify-between”> {/* Brand Logo */} <div className=”w-[40%]”> <Image src={logo} alt=”Brand Logo” className=”w-20″ /> </div> {/* menu item */} <div className=”flex-1″> […]