🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
26
node_modules/shiki/samples/tsx.sample
generated
vendored
Normal file
26
node_modules/shiki/samples/tsx.sample
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// posts will be populated at build time by getStaticProps()
|
||||
function Blog({ posts }) {
|
||||
return (
|
||||
<ul>
|
||||
{posts.map((post) => (
|
||||
<li>{post.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
// This function gets called at build time on server-side.
|
||||
export async function getStaticProps() {
|
||||
const res = await fetch('https://.../posts')
|
||||
const posts = await res.json()
|
||||
|
||||
return {
|
||||
props: {
|
||||
posts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Blog
|
||||
|
||||
// From https://nextjs.org/docs/basic-features/data-fetching
|
||||
Loading…
Add table
Add a link
Reference in a new issue