question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pages/_app.js doesn't have getStaticProps

See original GitHub issue

Feature request

I think _app.js also should have getStaticProps as Layout, Providers etc can use it’s data.

(Having that _app.js has getInitialProps it will be good)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:65
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
cdock1029commented, May 19, 2020

I have a select menu inside my app header that I want to pre-populate with data at build. I wrap all pages with this in _app.tsx.

getStaticProps would be useful here, else I have to put this on every page individually, and pass props down

6reactions
sven-racommented, Jun 5, 2020

Any news on this, is the restriction going to be lifted?

My use case: Fetch Site meta data and navigation menus.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use getStaticProps in _app.js for showing data fetched ...
And I want to use getStaticProps to get those data on all the pages. But the problem is I need to do getStaticProps...
Read more >
getStaticProps on _app · Discussion #10949 · vercel/next.js
Since getStaticProps is a static function that is exported by the file, and not connected to the page function, this makes total sense....
Read more >
Data Fetching: getStaticProps - Next.js
When you navigate to a page that's pre-rendered using getStaticProps , Next.js fetches this JSON file (pre-computed at build time) and uses it...
Read more >
What's New in Next.js 13 - AppSignal Blog
Let's explore the new features and improvements in Next.js 13.
Read more >
Updating the properties of the getstaticprops method ... - Webera
After the page is rendered by the server, these attributes are immutable. ... Since Next.js does not have a “refetchProps” method, we can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found