Questions tagged [next.js13]

339 questions
1
vote
1 answer

How can i pass a global state from layout.js/tsx file to routes on next.js 13

in next.js 13, i want to pass my values to the routes from layout.js/tsx file with props. How can i do that without using useContext or useReducer? I want to make seperate back and front-end and intend to use next.js on front-end.
Necoo33
  • 11
  • 3
1
vote
0 answers

Next js and graphql on demand revalidation in app router

I am creating next.js application with app router and appollo graphql, for graphql query i have used appolo @apollo/experimental-nextjs-app-support module, in next.js app router they have on demand validation pass in fetch api as per above…
vipul
  • 21
  • 4
1
vote
1 answer

Error while using getServerSideProps() in next.js 13 using App Router

If I write a new page.tsx in a folder e.g. src/app/parts/test i get all the time the error, that the Props are undefined. Here my Code (it should work...) src/app/parts/test/page.tsx import { NextPage, GetServerSideProps } from 'next'; interface…
Carlo
  • 112
  • 5
1
vote
1 answer

How to access Token in next-auth?

I want to implement my credentials login logic. The problem is i can't access token in useSession hooks. I need token to send it to backend for REST API's endpoints. I searched a lot, read a lot and even asked ChatGPT but nothing worked for me. This…
Solid1
  • 426
  • 1
  • 2
  • 14
1
vote
1 answer

Padding, Margin, default color are not working tailwind + daisyui

I use a next.js 13 project with app directory and tailwind + daisy UI config. padding, margin and colors are not working. const ContactUs = () => { return ( <>
sarem eskandary
  • 504
  • 4
  • 16
1
vote
1 answer

Navigating to Intercepted Routes in Next.js 13 without Hard Refresh

I'm working on a Next.js application where I have implemented the Intercepting Routes feature. I have a directory structure in the app directory that looks like this: /news/[id]/page.jsx /@modal/(.)news/[id]/page.jsx The behavior I desire is as…
Hh Dreamer
  • 43
  • 6
1
vote
0 answers

URL's hash changing in Next.js 13

Is it possible to spy for the #hash in Next.js 13v apps? What do I do wrong? Its seems like 'hashchange' event just doesn't work an anaught - only for the first app render. Now I'm trying to do this, but it's doesn't work: My layout.tsx: import…
ais
  • 11
  • 2
1
vote
0 answers

Next.js ^13.4 Data Cache does not appear to be caching duplicate requests

I am using nextjs and its new app directory layout, and have been referencing this link in regards to caching and strategy. I have a dynamic SSG page that builds thousands of instances of that page. Each page makes two api calls, one for common data…
1
vote
0 answers

next/server should not be imported outside of pages/_middleware.js

I don't know why I am getting this error during the production build like npm run build My project structure is like below project/ - src/ - app - middleware.js and the middleware file is like export { default } from…
user9769384
  • 70
  • 1
  • 18
1
vote
0 answers

How to guard routes using localstorage on nextjs 13?

I want to be able to redirect the user for a login page if he access any route and is not logged in. As simple as can be done, i'm trying to redirect the user to login, so I get the user from localstorage and if undefined or null i redirect to…
Eduardo Fellipe
  • 376
  • 2
  • 14
1
vote
1 answer

How can I change background color of layout.tsx body component based on page?

I have a Next.js 13 project with a layout.tsx file in the root of my app directory that looks like this: import Footer from "../components/Footer"; import HeaderDecoration from "../components/HeaderDecoration"; import Logo from…
esd
  • 63
  • 1
  • 4
1
vote
0 answers

How to disable Next.js scripts, `NEXT_DATA` and React rehydration in NestJS 13

How would I do this but for NestJS using app router?
Kevin Jiang
  • 271
  • 3
  • 10
1
vote
0 answers

next-auth CredentialsProvider for Next.js 13.4 not working in app directory with external backend

I have a project that uses an external backend for authentication. After a successful login, cookies are sent back. On the signIn page, I used 'use client.' It worked fine when I was using Next.js version 13.2, and the cookies were set correctly. In…
1
vote
1 answer

How to set `meta:redirect` or `` in Next.js 13 metadata object?

I want to redirect users from one of my pages. I used to do it with redirect metatag. However, I don't find similar options in metadata api in Next.js 13 appRouter.
Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122
1
vote
1 answer

How to fix import suggestion in next.js and next-auth VS Code?

I have problem in VS Code. When I type eg. signIn which is function in next-auth I don't get auto import suggestion. What is problem? My jsconfig file: { "compilerOptions": { "paths": { "@/*": ["./*"] } } } nextconfig file: /**…
mirnes99
  • 51
  • 3