import React, { useEffect, useState } from "react"; import { Link, useLocation } from 'react-router-dom' import Bredcrumb from '../../Bredcrumb/Main' import BGImg from "../../../assets/images/bread_crumb_bg.png" import BGImg1 from "../../../assets/images/bread_crumb_bg_one.png" import BGImg2 from "../../../assets/images/bread_crumb_bg_two.png" import { useParams } from "react-router-dom"; import SiteService from "../../../vendors/service/siteService"; const Main = ({brdcum}) => { const { id } = useParams(); const location = useLocation(); const [blogData, setBlogData] = useState([]); const [newAllData, setNewAllData] = useState([]); useEffect(() => { getBlogData(); getLatestBlog(); }, [location.state?.data]); const api = new SiteService(); const data = location.state?.data; const allData = location.state?.allData; const getLatestBlog = () =>{ const arrData = [ ...allData ]; const itemIndex = arrData.findIndex(x => x.id === data.id) arrData.splice(itemIndex, 1); const newAllData = arrData.splice(0, 3); setNewAllData(newAllData); console.log('All data ', arrData, newAllData); } const getBlogData = async () => { try { const res = await api.blogData(); setBlogData(res.data); } catch (error) { console.log("Error from blog data ", error); } }; return ( <> {brdcum.b1 && } {brdcum.b2 && } {brdcum.b5 && } {brdcum.b3 && } {brdcum.b4 && }
Review {/* 45 min ago */} {new Date (data && data.post_modified).toDateString()}

{data && data.post_title}

image

{data && data.post_name}

{/*
image
*/}

{data && data.post_author}

{new Date (data && data.post_date).toDateString()}
{/*

3 Comments

  • image
    30 min ago

    Dolly Shell

    Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the in dustrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen.

  • image
    15 min ago

    Devil Joe

    Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the when.

  • image
    2 days ago

    Sherly Shie

    Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the in dustrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen.

Leave a comment

Your email address will not be published. Required fields are marked *

*/}

Read latest story

Lorem Ipsum is simply dummy text of the printing and typese tting
indus orem Ipsum has beenthe standard dummy.

{newAllData.map((data) => { return (
image 45 min ago

{data.post_title}

{/* READ MORE */} READ MORE
)})} {/*
image 45 min ago

Top rated app! Yupp.

Simply dummy text of the printing and typesetting industry lorem Ipsum has Lorem Ipsum is.

READ MORE
image 45 min ago

Creative ideas on app.

Printing and typesetting industry lorem Ipsum has Lorem simply dummy text of the.

READ MORE
*/}
) } export default Main