import React, { useState, useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { motion, AnimatePresence } from 'framer-motion';
import PageLoader from './PageLoader';
const RouteTransition: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const location = useLocation();
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
// Trigger loading on route change
setIsLoading(true);
const timer = setTimeout(() => {
setIsLoading(false);
}, 2000); // 2 seconds loader on every page transition
return () => clearTimeout(timer);
}, [location.pathname]);
return (
<>