import axios from "axios";
function Conteudo({ posts }) {
return (
<ul>
{posts.map((post) => (
<li>{post.data}</li>
))}
</ul>
)
}
export async function getStaticProps() {
const res = await axios.get('http://localhost:1337/posts');
const posts = await res.json();
if (!data) {
return {
notFound:true
}
}
return {
props: {
props:posts
},
}
}
export default Conteudo;
-
olha Guilherme, já fez debug no código? Inspecionou o que tem na variável "posts"? – Ricardo Pontual 23/02 às 9:46
comentar
|