import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; const Search = () => { const { bookingCheck } = useSelector((state) => state); const [searchId, setSearchId] = useState(''); const [foundBooking, setFoundBooking] = useState(null); const navigate = useNavigate(); const handleSearch = () => { const match = bookingCheck.find(b => b.id.toString() === searchId.trim()); setFoundBooking(match || 'not_found'); }; return (
No Booking happened yet
} {foundBooking === 'not_found' &&No Booking Found
} {foundBooking && foundBooking !== 'not_found' && (ID: {foundBooking.id}
Name: {foundBooking.name}
Contact: {foundBooking.contact}
Game: {foundBooking.game}
Slot: {foundBooking.slot}
Date: {foundBooking.date}