import ArticleCard from '@/components/ArticleCard'; import { Article } from '@/types'; import styles from '@/styles/ArticlesPage.module.css'; interface ArticlesPageProps { articles: Article[]; } const ArticlesPage = ({ articles }: ArticlesPageProps) => { return (

My Articles

Recent posts from{' '} dev.to {' '} where I share insights and tutorials about web development.

{articles.length > 0 ? ( articles.map((article) => ( )) ) :(

No articles available at the moment.

)}
); }; export async function getStaticProps() { const res = await fetch( 'https://dev.to/api/articles/me/published?per_page=6', { headers: { 'api-key': process.env.DEV_TO_API_KEY!, }, } ); const data = await res.json(); return { props: { title: 'Articles', articles: data }, revalidate: 60, }; } export default ArticlesPage;