()
| 9 | } |
| 10 | |
| 11 | export const useSearchHistory = () => { |
| 12 | const [_searchHistory, setSearchHistory] = useLocalStorage<Search[]>("searchHistory", []); |
| 13 | |
| 14 | const searchHistory = useMemo(() => { |
| 15 | return _searchHistory.toSorted((a, b) => { |
| 16 | return new Date(b.date).getTime() - new Date(a.date).getTime(); |
| 17 | }); |
| 18 | }, [_searchHistory]); |
| 19 | |
| 20 | return { |
| 21 | searchHistory, |
| 22 | setSearchHistory, |
| 23 | } |
| 24 | } |
no outgoing calls
no test coverage detected