"use client"
import React, { useState, useEffect } from 'react'
import { usePathname, useSearchParams } from 'next/navigation'
import Loading from './Loading'
// const Loader = () => (
//
// );
export default function RouteLoader() {
const pathname = usePathname()
const searchParams = useSearchParams()
const [loading, setLoading] = useState(false)
useEffect(() => {
setLoading(true)
const timer = setTimeout(() => setLoading(false), 300) // Adjust timeout as needed
return () => clearTimeout(timer)
}, [pathname, searchParams])
return loading ? : null
}