Questions tagged [getstaticprops]

90 questions
0
votes
0 answers

Nextjs Build Error: Export encountered errors on following paths /users/[userid]

i have created a nextjs app, i'm getting data from an express server deployed on netlify. i have created two pages, the first to display a list of users (i've got the users with getServerSideProps() function) and the second page is when you click on…
0
votes
1 answer

NextJS routing error, when changing pages, the wrong file is trying to open

What I want I want to change pages without next thinking I am trying to open another page. The Problem I have this weird routing problem. First, my folder structure pages [app] [object] index.js index.js manager.js feed.js I…
Mähnenwolf
  • 720
  • 10
  • 30
0
votes
0 answers

NextJS header - Contentful Data

I would like to present "Recent Articles" in my header menu "Learn", but since I'm using NextJS I cannot use getStaticProps in a custom component. How can I pass my GraphQL query from my articles page to my custom components? Can anyone help me with…
Mathias Riis Sorensen
  • 504
  • 3
  • 13
  • 34
0
votes
0 answers

How to read from a file in custom App component in next.js

I have a requirement to read a file in _app component and pass its content through a provider to make it available to the whole application. The project is using antd for components and emotions for styling. Since antd uses less for styling, we…
Prince Agrawal
  • 380
  • 4
  • 14
0
votes
1 answer

getstaticprops cannot use params from getstaticpaths in case of dynamic routing? MongoDB

I am making a webpage which fetches data from mongoDB( atlas BASIC free plan) and has dynamic routing page with SSG. The dynamic routing page, [cogid].js, has getstaticpaths and getstaticprops. getstaticpaths seems work, but getstaticprops does not…
0
votes
1 answer

getStaticPath and the need for filetype in the URL

In /pages I have [page].js and index.js. [page].js generate needed Pages by the Value of "CustomPage". It's content comes from an Data-JSON-File. It work like expected, as long as I start on the Homepage and use links inside of my Webpage. For…
suther
  • 12,600
  • 4
  • 62
  • 99
0
votes
1 answer

NextJS: "TypeError: Cannot read property 'toLowerCase' of undefined"

While usign the getStaticPaths() and getStaticProps() I am getting the error NextJS: "TypeError: Cannot read property 'toLowerCase' of undefined"
0
votes
2 answers

Next.js: How can we have dynamic routing redirect to static pages?

Using Next.js , I currently have an app with a single entry point in the form of /pages/[...slug]/index.ts It contains a getServerSideProps function which analyses the slug and decide upon a redirection In some cases a redirection is needed, but it…
Sébastien
  • 5,263
  • 11
  • 55
  • 116
0
votes
1 answer

Data fetching with nextjs 'catch all' routes

With nextjs 10, you can have a catch all route, which looks something like this [...id].tsx. The idea is that this will allow for dynamic pages. So it should match /example, /example/new, /example/new/latest etc. The issue im facing is that a…
Samuel
  • 2,485
  • 5
  • 30
  • 40
0
votes
0 answers

Fetch data at component level and have it prerendered/ssr nextjs

I'm working with Nextjs for the first time. I'm trying to create multiple layouts which will consist on a
structure. The issue that I'm facing is that getStaticProps or getServerProps can run at the page…
Jaypee
  • 1,272
  • 5
  • 17
  • 37
0
votes
0 answers

How do I use my axios call for getStaticPaths and getStaticProps

I have a component which renders the response (Successfully verified, Has been verified already, and this token has expired) from making a call to my server from clicking a link in a Account Verification email I sent after registering. At very rare…
Antonio Pavicevac-Ortiz
  • 7,239
  • 17
  • 68
  • 141
-1
votes
1 answer

why getStaticProps not not working in page

why getStaticProps function not working. even inside a valid page. this is folder structure with target file enter image description here The console inside getStaticProps() does not print anything & the console inside Home() prints "undefined".
-1
votes
1 answer

Error: A required parameter (productId) was not provided as a string in getStaticPaths for /products/[productId]

I would like to show 3 products from a JSON. I'm trying to do a NextJS web application. I'm just learning, and when I replicate the tutorial is everything correct, but I'm doing my own changes, and trying to create something different, but it…
-2
votes
1 answer

How to handle dynamic authorization-based content in Next.js with getStaticProps or getServerSideProps?

I am building a Next.js application where I need to fetch and display content based on the user's authorization status. I initially used getStaticProps to fetch and cache the content at build time. However, I realized that the cached content is…
János
  • 32,867
  • 38
  • 193
  • 353
1 2 3 4 5
6