How to extract WebAPI data through map method in React JS

I am working on a personal project to learn react and come to a problem. I’ve fetched data from WebApi and having trouble to extract information to pass as props into react router component and homepage component.
This is my App.js

import React from 'react';
    import Layout from './components/pages/Laypout.js';
    import About from './components/pages/About.js';
    import ErrorPage from './components/pages/error-page.js';
    import Contact from './components/pages/Contact.js';
    import Support from './components/pages/Support.js';
    import Home from './components/Home.js';
    import { useEffect, useState } from "react";
    import {
    createBrowserRouter,
    RouterProvider,
   } from "react-router-dom";

   const CompanyID = "Demo";


   const apiURL = `http://localhost:58407/api/Demo`

   function App() {
    //fetching data from API
    const [contents, setContents] = useState([]);
    const [isLoading, setisLoading] = useState(false);
    const [error, setError] = useState();

    const fetchContents = async () => {
    try {
      setisLoading(true);
      const response = await fetch(apiURL);
      const jsonData = await response.json();
      setContents(jsonData)
      //console.log(jsonData)
      if (!response.ok) {
        throw new Error(jsonData.message)
      }
    } catch (err) {
      setError(err)
    } finally {
      setisLoading(false);
    }
    }

    useEffect(() => {
    fetchContents();
    }, []);

    if (isLoading) {
    return <div>Loading...</div>
    }
     if (error) {
      return <div>Something went wrong, please try again</div>
      }
  
    const contentItems = contents.map((content) => {
    
    console.log(content)
    return <div key={content.PageID}>
      {content.PageTitle}
      {content.PageText}
      {content.Message}
      .......etc //other fields
    </div>
    });

    console.log(contentItems)
    const router = createBrowserRouter([
    {
      path: "/",
      element: <Home />,
      errorElement: <ErrorPage />,
    },
    {
      path: "/",
      element: <Layout />,
      //errorElement: <ErrorPage />,
      children: [
        {
          path: "/about",
          element: <About title={contentItems}/>,     //want to pass here only Aboutus Page title and contents
        },
        {
          path: "/contact",
          element: <Contact />,       //same like aboutus
        },
        {
          path: "/support",
          element: <Support />,      //same as above
        }
      ]
    },
    ]);

    return (
    <RouterProvider router={router} />
    );
    }
    export default App;

This is About component

export default function About(props) {
  
    return (
        <div className="container">
            <h1>{props.title}</h1>
            <p>{props.text}<h1>
        </div>
    )
    }

This is homepage component

import HelpDesk from './HelpDesk.js';
import Category from './Category.js';
import MiddleContactUs from './MiddleContactUs.js';
import Faqs from './Faqs.js';
import BottomMessage from './BottomMessage.js';
import Footer from './Footer.js';
import Navbar from './Navbar.js';
import HeaderBanner from './HeaderBanner.js';

    export default function Home() {

    return (
        <>
            <div className="header">
                <Navbar  />
                <HeaderBanner />
            </div>
            <Category />
            <Faqs faq={props.faqs}/>
            <BottomMessage message={props.msg}/>
            <Footer msg={props.message}/>
        </>
    )
    }

This is data fetched from API from which I want to extract data like PageTitle, PageText, Heading, Footer message etc so I can pass them as props wherever I need.

{PageTitle: 'Aboutus', PageText: 'Page content text here', ContentID: 5, Heading: 'Aboutus Page', FooterMessage: 'Welcome to Demo', BottomMsg: 'This is test'}
{PageTitle: 'Contactus', PageText: 'Page content text here', ContentID: 5, Heading: 'Contactus Page', FooterMessage: 'Welcome to Demo', BottomMsg: 'This is test'}
{PageTitle: 'Support', PageText: 'Page content text here', ContentID: 5, Heading: 'Support Page', FooterMessage: 'Welcome to Demo', BottomMsg: 'This is test'}

So I need to know how should I pass props in About us, contact us page which are under react router and then other props in homepage which has multiple nested small component itself.

New contributor

Mohd Afzal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật