Tutorial > Pre-rendering and Data Fetching > Implement getStaticProps #23454
Unanswered
esthonjr
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Nvm: I didn't reload the server after _app.js update, the order is irrelevant.
_FYI:
ref: https://nextjs.org/learn/basics/data-fetching/implement-getstaticprops
In the tutorial is said "Open pages/index.js in your editor and add the following code above the exported Home component:"
But the "export async function getStaticProps()" portion should be BELOW the exported "Home" component, not above.
I was getting "TypeError: Cannot read property 'map' of undefined" on "allpostsdata" because of the mislocation. I was never getting props from getStaticProps._
Beta Was this translation helpful? Give feedback.
All reactions