// Next.js component using getStaticProps for data fetching
import fetch from 'node-fetch';
const MyComponent = ({ data }) => (
<div>
<h1>{data.title}</h1>
<p>{data.description}</p>
</div>
);
export async function getStaticProps() {
const response = await fetch('https://example.com/api/data');
const data = await response.json();
return {
props: {
data,
},
};
}
export default MyComponent;