Any better way to resolve Issues storing value from dropdown menu?

I have been trying to figure out why I couldn’t log the value of requestData to the console successfully. Somehow it’s not storing the value of selectedCategory in category as expected. Please help

// formInputComponent

import React, { useState } from 'react';
import DropdownContent from './NicheDropdown';
import { useSession } from "next-auth/react";

const CommChat = () => {
    const [message, setMessage] = useState('');
    const [response, setResponse] = useState('');
    const { data: session } = useSession();

    const email = session?.user?.email;
    const [selectedCategory, setSelectedCategory] = useState('');

    const blogCategories = [
        { name: "Books and Literature", href: "#", icon: "booksIcon" },
        { name: "DIY and Crafts", href: "#", icon: "diyIcon" },
        { name: "Learning", href: "#", icon: "educationIcon" },
       
    ];

    const handleCategorySelect = (category) => {
        console.log("Selected category:", category);
        setSelectedCategory(category.name);
    };

    const handleSubmit = async (event) => {
        event.preventDefault();

        console.log("Request data:", requestData, selectedCategory);

          if (!selectedCategory) {
             console.error("Please select a category");
            return;
         }

        const requestData = {
            category: selectedCategory,
            message: message,
            email: email
        };

        console.log("Request data:", requestData);

        try {
            const response = await fetch('/api/chatContent', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(requestData)
            });

            if (response.ok) {
                const responseData = await response.json();
                setResponse(responseData.message);
            } else {
                console.error('Failed to send message');
            }
        } catch (error) {
            console.error('Error:', error);
        }
    };

    return (
        <div className="w-11/12">
            <div className="relative w-full">
                <footer className="max-w-4xl mx-auto sticky top-0 p-3 sm:py-6">
                    <form onSubmit={handleSubmit}>
                        <DropdownContent
                            className="flex flex-col"
                            blogCategories={blogCategories}
                            onSelect={handleCategorySelect}
                        />
                        <textarea
                            className="p-4 pb-12 block w-full bg-gray-100 border-gray-200 rounded-lg text-sm focus:border-red-500 focus:ring-red-500 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600"
                            placeholder="What's going on today..."
                            value={message}
                            onChange={(e) => setMessage(e.target.value)}
                        />
                        <button className='bg-slate-500 hover:bg-slate-600 text-white font-bold py-2 px-4 rounded-md my-4' type="submit">Send message</button>
                    </form>
                    {response && <p>{response}</p>}
                </footer>
            </div>
        </div>
    );
};

export default CommChat;

//Dropdown component

import React, { useState } from "react";
import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, Button } from "@nextui-org/react";

const DropdownContent = ({ blogCategories }) => {
    const [selectedNiche, setSelectedNiche] = useState(null);

    const handleNicheSelect = (niche) => {
        setSelectedNiche(niche);
    };

    return (
        <Dropdown>
            <DropdownTrigger>
                <Button className="text-black font-thin h-7 rounded-none mb-1">
                    <img src="/images/niche.png" className="w-6 h-6" />
                    {selectedNiche ? selectedNiche.name : "Select a Niche"}
                </Button>
            </DropdownTrigger>
            <DropdownMenu aria-label="Dropdown blogCategories" className="dropdown-menu overflow-y-auto">
                {blogCategories && blogCategories.map((item) => (
                    <DropdownItem key={item.name} onClick={() => handleNicheSelect(item)} className="text-black font-thin">
                        {item.name}
                    </DropdownItem>
                ))}
            </DropdownMenu>
        </Dropdown>
    );
};

export default DropdownContent;

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