Questions tagged [app-router]
116 questions
0
votes
0 answers
Update className on on route change (on the server)
In the Next.js (app router), I have a dynamic route (app/[page]/page) which fetches data from a CMS for each unique page. Among that data, I get a theme. I want to set that theme on the , on the server, so that it is sent to the browser with…
0
votes
0 answers
Next.js Server Functions cannot be called during initial render
Im trying to render some hard coded projects using the "render prop" method.
import React from "react";
import projects from "./myProjects";
import Carousel from "@/components/Carousel";
const ProjectRenderer = async (project: { title: string }) =>…

barakolshe
- 7
- 3
0
votes
0 answers
How to structure folders in nextJs 13
1st Question:
I saw some people that they are creating components folder inside a page folder
**Example 1:
src/
app/
gallery/
components
page.tsx**
On the other hand, I preferred this structure
**Example 2:
src/
…

Tech
- 1
- 2
0
votes
1 answer
NextJS 13 app router doesn't refresh data on update with router.push
I have NextJS 13 app with app router. Which displays a table (shadcn UI) data-table with server side pagination. I have a create button that goes to a create page, And I can create a new entry into the table. On success of the API I do…

Abhishek AN
- 648
- 7
- 24
0
votes
1 answer
hooks in statically generated pages with NextJS app router
Short question: how do I get an action to take effect on page-load for the app router equivalent of statically generated pages from static paths in NextJS?
Longer version, my page generation is working fine:
// app/layout.js
import Providers from…

philolegein
- 1,099
- 10
- 28
0
votes
0 answers
How to upload files or images using app router in nextjs 13?
I used app router in nextjs 13 to create my own project, I also used api/route.js feature in nextjs13 to manage my backend. I created an api to store my products information in mongodb. The problem I have is that I want to store the images of my…
0
votes
1 answer
Parallel route modal using Next.js 13's App Router returns 404 on refresh
I'm trying building modal using parallel routes in Next.js 13.4.
It works when I'm on the homepage (/) and open the modal (push to /login).
But when I refresh the /login page, instead of showing homepage with modal, it shows the 404 page with the…

Ruelle Paul
- 21
- 4
0
votes
0 answers
Refreshing stale data in next js app router without refreshing page
The new App router in Next emphasises and encourages fetching data on the server through server components. However I can't find documentation for a strategy to refresh said data on the client side without refreshing the entire page.
Here is a…

McShaman
- 3,627
- 8
- 33
- 46
0
votes
0 answers
Global Revalidate value | X is not a valid. The configuration must be statically analyzable
Does anyone know how to use global config for Nextjs?, I'm using the new App Router (./app), before this new router this code worked
constants.ts file
export const REVALIDATE_ITERATIONATION: number = 1800
page.tsx file
export const revalidate =…
0
votes
1 answer
Title is not displayed inside head tag in Next.js 13.4 application
I'm building an application using Next.js 13.4. I've added title and description inside metadata but it is not getting displayed in the browser.
"use client";
import Navbar from "@/components/Navbar";
import "./globals.css";
import type { Metadata }…

Steevel sharon Salis
- 13
- 3
0
votes
1 answer
Error when building Next.js 13.4 app: Type 'ResolvingMetadata | undefined' does not satisfy the constraint 'ResolvingMetadata'
I'm trying to dynamically generate metadata for my Next.js 13.4 app using the following code:
export async function generateMetadata(
{ params, searchParams }: Props,
) {
try {
// read route params
const id = params.itemId;
…

Githendra McShane
- 76
- 8
0
votes
0 answers
problem in dark theme webview with next js 13 app router
I get the value of the theme through the parameter and I want it to be determined based on that webview template. It occurred to me, I went with Next Theme and Tailwind. It occurred to me that in the client component of the theme switcher, a button…
0
votes
1 answer
Anchor links (#) not working within the same page in Next.JS app router
I have a component with the href set to #targetDiv in my Next.js app. Ideally, when a user clicks on the button/link, the page should scroll to the respective section with the id #targetDiv . But it doesn't work that way.
I went through some…

Rockafella96
- 11
- 5
0
votes
1 answer
How to Exclude Layout from Display on Specific Pages in Next.js 13 App Router
I'm working on a personal project using Next.js 13 app router and I've encountered an issue. In my project, there's a header component that's injected into the layout.tsx file in the root directory. However, I also have a dashboard page that should…

Abubalo
- 17
- 1
- 5
0
votes
0 answers
Communicate between Next JS Web and Native Mobile App
I'm having a web server by Next JS (BE by Spring), and iOS, Android App. I'm handling change page in Web, and i want Native apps to detect this for handle some logic in apps.
I tried to use window.webkit.messageHandlers but it return Cannot read…

MinhDat
- 57
- 3