Relative Content

Tag Archive for reactjstypescriptnext.js

Fetched API data is being cached Next.js 14.2.8

My application has an API that has dice roll function it works as intended when running in development mode but when I build for production the data in the first API call becomes cached and the data on the page is not updated when the API is called for a second time.

Functions passed as props to several functional components don’t update common variables correctly

I have been working on a navbar functionality in next.js. I have two functions (for the mobile interface of the website) that respectively close and open the navbar, using a hamburger menu (for opening it) and an X icon on the navbar (for closing it). These two functions are defined inside the page export (see code below) and update local variables defined in the page export, after which they are passed down as props to the hamburger component and the navbar component.

Nextjs build failed. Types mismatch

My app is running well. It is very slow in development mode. So i tried to build it. During build i’m getting type error. i tried to figure it out but still facing.

Type error: Type ‘Element’ is not assignable to type ‘NextPage’

“use client” import React from ‘react’; import Sidebar from ‘./page’; import type { NextPage } from ‘next’; interface LayoutProps { children: React.ReactNode; } export default function Layout({ children }: LayoutProps): NextPage<LayoutProps> { return ( <div className=”app-container”> <Sidebar /> <main className=”main-content”>{children}</main> </div> ); } `this is my code for layout.tsx in nextjs(14.2) project when i build […]