import { getDevtoArticle, getMediumArticle } from "article-api"; import moment from "moment"; import { memo, useEffect, useState } from "react"; import { CgHashtag } from 'react-icons/cg'; import config from "../config"; import { skeleton } from "../helpers/utils"; const Blog = () => { const [articles, setArticles] = useState(null); useEffect(() => { if ( typeof config.blog !== 'undefined' && typeof config.blog.source !== 'undefined' && typeof config.blog.username !== 'undefined' && config.blog.source && config.blog.username ) { if (config.blog.source === 'medium') { getMediumArticle({ user: config.blog.username }) .then(res => { setArticles(res); }); } else if (config.blog.source === 'dev.to') { getDevtoArticle({ user: config.blog.username }) .then(res => { setArticles(res); }); } } }, []) return (
{moment(article.publishedAt).fromNow()}
{article.description}