You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently need to include getStaticProps in every page to fetch data on the server when creating a static page.
Instead, I tried to put that function and just reexport it per page, and can confirm that this works.
On a page this would just look like this:
import getStaticProps from "staticUtils/pageHelpers/getDefaultStaticProps";
export { getStaticProps };
TBD: We could create multiple functions similar to getDefaultStaticProps which include other specific fetches, or make a more sophisticated approach where you don't just reexport getStaticProps, but call that helper with a list of requirements and it returns the proper getStaticProps function.
Rationale for why this feature is necessary
There is a lot of duplication for getStaticProps, as most pages will fetch the same data.
Expected use cases
Used on every page in the storefront
The text was updated successfully, but these errors were encountered:
Summary description
We currently need to include
getStaticProps
in every page to fetch data on the server when creating a static page.Instead, I tried to put that function and just reexport it per page, and can confirm that this works.
On a page this would just look like this:
TBD: We could create multiple functions similar to getDefaultStaticProps which include other specific fetches, or make a more sophisticated approach where you don't just reexport
getStaticProps
, but call that helper with a list of requirements and it returns the propergetStaticProps
function.Rationale for why this feature is necessary
There is a lot of duplication for getStaticProps, as most pages will fetch the same data.
Expected use cases
Used on every page in the storefront
The text was updated successfully, but these errors were encountered: