Next getStaticProps



    Jose Romero

    NextJS Javascript Recipes

    To fetch this data on pre-render, Next.js allows you to export an async function called getStaticProps from the same file. This function gets called at build time and lets you pass fetched data to the page's props on pre-render.

    Library: next

    Shortcut: next.static.props.create

    Filename pattern: *pages/*.tsx

    export async function getStaticProps() {
      return {
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.