Type-safe routes with [locale] pathname segment
What’s the best approach to typing app routes for an i18n app? Previously I just read the request headers (cookies and accept-language) to get the locale, and the experiemental typedRoutes
feature worked perfectly. I was recently convinced to move the locale into the pathname. I can still write paths without including the locale segment. The middleware then redirects to the correct path by doing the same lookup as before. However it would save a round-trip and a little compute to just include the current locale in the path to begin with. I’m using i18next
if that matters.
Next js typescript conditionally export a module
In Next.js (v.15 w/ App Router) i have 2 modules of server actions where i export the same functions, each with a different database, like so :
Next js typescript conditionally export a module
In Next.js (v.15 w/ App Router) i have 2 modules of server actions where i export the same functions, each with a different database, like so :
Next js typescript conditionally export a module
In Next.js (v.15 w/ App Router) i have 2 modules of server actions where i export the same functions, each with a different database, like so :
can’t build the project (NextJS)
When run in dev mode, it works, but I can’t build my code to production.
this is my code
How can I manage separate state for search results and product listings in a React app using the same API?
I am working on a React app where I fetch product listings and search results from the same API. However, I want to keep the state of the product page (productPageResults) and search results (searchResult) separate so that when a user performs a search, it doesn’t overwrite the product listings.
How to cache Next.js first page load compilation for local development
I’d like to speed up development in my TypeScript Next.js project.
How to cache Next.js first page load compilation for local development
I’d like to speed up development in my TypeScript Next.js project.
Having trouble in formatting the AI model’s response
I’m having trouble in formatting the response its making spaces in between of names and the response looks ugly so i need help to find a better approach.
Where or how do i store JWT access token in a next.js app router app?
I’ve got a backend that uses a JWT auth, when i log in, it sends me access token in the body of the response and refresh token in http-only cookies. I get the part with the refresh-token, it’s attached on every request, fine, but what about access token. What’s the most convinient way to store it?