#Where should I place getStaticProps()?

12 messages · Page 1 of 1 (latest)

lavish harness
#

Export a function named getStaticProps in the page you need the data for, and export by default your page component. Next will pass the data to the props of your page component, you can simply get the data inside the props of your page component like any react component.

long karma
#

That looks strange to paste my fetch in all pages

willow spear
#

You can use it in a page.

#

Simple as that.

long karma
#

Menu is not part of Page

#

_app

#

layout

lavish harness
#

Yes, this is currently what I would call an issue from the design of the framework (they re working on an RFC for all the latout stuff). Data is only passed through pages, but you can still access it inside _app if you will, or just get back to client side rendering

willow spear
#

What do you need to know in the layout