// Example from https://beta.reactjs.org/learn import React, { useState, useEffect } from "react"; import ReactMarkdown from 'react-markdown' import styles from './releases.module.css' import gfm from 'remark-gfm' function dateformate(date){ const event = new Date(date) return event.toDateString() } function Releases() { const [books, setBooks] = useState(null); useEffect(() => { getData(); async function getData() { try { const response = await fetch( "https://api.github.com/repos/kalanakt/All-Url-Uploader/releases" ); const data = await response.json(); setBooks(data); } catch (error) { console.log(error); } } }, []); return (
{books ? (
{books.map((book: { [x: string]: any; commit: { message: string | number | boolean | React.ReactElement> | React.ReactFragment | React.ReactPortal; author: { date: string; }; comment_count: string | number | boolean | React.ReactElement> | React.ReactFragment | React.ReactPortal; verification: { verified: string | number | boolean | React.ReactElement> | React.ReactFragment | React.ReactPortal; }; }; html_url: string; comments_url: string; author: { [x: string]: string; login: string; avatar_url: string; }; }, index: React.Key) => { return (
{book.tag_name} ({dateformate(book.published_at)})
{book.draft ? Darft : book.prerelease ? Pre release : Release}
{book.body.split(' ').slice(0, 20).join(' ')}
Read More ...
); })}
) : ( 404 : Page Not Found )}
) } export default function MyApp() { return }