Skip to main content

All Questions

Tagged with
0 votes
0 answers
15 views

NextJS App router reusable custom hook for data fetching

I'm currently trying to migrate a project from NextJS pages router to the app router. In my old project, I had the following structure: /src /components /hooks customHook.tsx /services ...
Mari's user avatar
  • 41
1 vote
0 answers
21 views

How to pre-load heavy scss layout styling in app router (Next.js 13-14)?

In my Next.js 14 app router project, I have to do some useEffect (client) works in my layout. Because new layout.tsx is server side rendered, I created a RootLayout.tsx component and added "use ...
Alperen Sözen's user avatar
-1 votes
1 answer
89 views

Sharing User Data Between Server Components of Different Pages in Next.js 14

I am using Next.js 14 with the app router. In my main layout file, I am fetching user data using a server component and then sharing that data with a client component. I have a context provider that ...
abuzain's user avatar
  • 494
0 votes
0 answers
62 views

How to perform a projection for a firestore query in react? [duplicate]

I'm trying to do a simple restriction and projection on a firestore Database. I came up with this: import { getDocs, collection, query, where, select } from "firebase/firestore"; const ...
D. Rattansingh's user avatar
0 votes
1 answer
98 views

Error 'SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON' when Fetching Internal API for SSG with NextJS AppRouter on Vercel

I have a Next.js application with the following code: export default async function StaticSiteGenerator() { const res = await fetch(`https://{DOMAIN_NAME}/api/data`); const data = await res.json();...
user25401403's user avatar
0 votes
2 answers
67 views

Optimizing User Data Fetching in Next.js: Best Practices and Alternatives

I have a project in Next.js and I am using server actions. However, I am facing a problem: I am fetching user data separately on each page so that I can use it on the respective pages. Is there a way ...
abuzain's user avatar
  • 494
0 votes
0 answers
53 views

Using express.static as a Route Handler in Nextjs App Router

I have a Nextjs app that needs to serve files from folders other than /public. I have done this before, using Page router, with an approach similar to this: https://stackoverflow.com/a/70490960. ...
Jk041's user avatar
  • 962
0 votes
1 answer
82 views

Prevent browser back button from going to previous page for MUI modal/dialog in new NextJS approuter

I am using MUI, typescript, nextjs, with the new approuter. I would like to hijack the browser's back button behavior when the modal is open, so that it would close the modal instead of going to ...
Ts1's user avatar
  • 89
0 votes
0 answers
40 views

Loop in function keeps running after route changes (nextjs 14)

I have a component that is basically a file uploader, but it is meant for big files (like 10/20gb), I divide it in chunks, and have a while loop to send each chunk to my server. I have a button in the ...
Luc's user avatar
  • 412
0 votes
0 answers
68 views

How can I correctly fetch data when I get a parameter via the URL?

I use Next.js 13.4.4 with the App Router and fetching data on the server with native fetch and Route Handlers (according to https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-...
Valentin Marolf's user avatar
2 votes
2 answers
1k views

How to access previous route in Next.js 14 using App Router?

Existing threads are mostly relevant to the Pages router. I know that with react router I'm able to do this: const history = useHistory(); const { pathname } = useLocation(); history.push('/', { from:...
murk wood's user avatar
2 votes
1 answer
40 views

Changes on top level of nextjs app only effect the index page

I have a next.js app using Bulma, and a ServiceProvider. I import bulma and this provider at the top level of the application. This would be in my layout.js file, however the changes there don't ...
Connor Baltich's user avatar
2 votes
2 answers
399 views

How to check if user goes to a valid route when using Nextjs

i have a question, i've spend the past 2 hours looking for an answer on the web but i haven't find one. well im using Nextjs with the new App router. when a user navigate to an undefined route in app/...
Mohamed Aarab's user avatar
1 vote
2 answers
1k views

NextJS : Implement parallel routing with Next.js 14 for tab navigation without re-rendering pages?

I'm working on a project using Next.js 14 and I'm trying to implement a tab navigation system where each tab corresponds to a different route (/resume and /source). The goal is to navigate between ...
Oddwerth's user avatar
  • 162
3 votes
1 answer
371 views

How to get locale in non-page server-side components on Nextjs 14 app router?

I am developing a new Nextjs 14 app router project, using next-i18n-router & react-i18next to handle localization. I followed nextjs documentation and the provided tutorials in localization setup: ...
Emad Younan's user avatar

15 30 50 per page
1
2 3 4 5
10