[Next.js] Is there any way to use getStaticProps? #149
Answered
by
mfix-stripe
sevenc-nanashi
asked this question in
Q&A
-
Hello! export async function getStaticProps(_context) {
return {
props: {
test: "a",
},
}
}
export default function App({ Component, pageProps }: AppProps) {
const { markdoc, test } = pageProps
console.log(test) // => undefined
// ...
} I want to use it for static generation. |
Beta Was this translation helpful? Give feedback.
Answered by
mfix-stripe
Aug 1, 2022
Replies: 1 comment 2 replies
-
@sevenc-nanashi can you share more about what you are trying to accomplish? You can't explicitly use For example, you can pass values via the Markdoc frontmatter, and access them in |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mfix-stripe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sevenc-nanashi can you share more about what you are trying to accomplish? You can't explicitly use
getStaticProps
within a Markdoc file, but each file generates its owngetStaticProps
.For example, you can pass values via the Markdoc frontmatter, and access them in
_app.js
viapageProps.markdoc.frontmatter