Advertisement
thewitchking

Untitled

Jun 10th, 2025
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const handleResultClick = (result) => {
  2.   setIsDropdownOpen(false); // move this above
  3.   navigate(`/details/${result.id}`);
  4. };
  5.  
  6. <div
  7.   key={index}
  8.   className="px-4 py-2 hover:bg-gray-100 cursor-pointer text-sm"
  9.   onMouseDown={() => handleResultClick(result)} // changed from onClick
  10. >
  11.   {result.name}
  12. </div>
  13.  
  14.  
  15.  
  16. onChange={(e) => {
  17.   setSearchText(e.target.value);
  18.   if (e.target.value === "") setIsDropdownOpen(false);
  19. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement