import React, {useEffect, useState} from 'react'; import './Home.css'; import ReactMarkdown from 'react-markdown' import {AllBlogs} from "../static/data/Blogs"; import {Prism as SyntaxHighlighter} from 'react-syntax-highlighter' import {a11yDark as theme} from "react-syntax-highlighter/dist/esm/styles/prism"; function SingleBlog() { const [blog, setBlog] = useState(''); const [blogId, setBlogId] = useState(0); useEffect(()=> { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); setBlogId(parseInt(urlParams.get('id') || '')); }, []) fetch(AllBlogs[blogId].mdfile) .then(response => { return response.text() }) .then(text => { setBlog(text) }) return (

{AllBlogs[blogId].title}

{AllBlogs[blogId].date.toLocaleDateString()}

Return Home | All Blogs

) : ( {children} ) } }} > {blog}
); } export default SingleBlog;