25 lines
628 B
JavaScript
25 lines
628 B
JavaScript
// TransitionPage.jsx
|
|
import React, { useEffect } from 'react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
|
function TransitionPage({data , onChanged}){
|
|
const navigate = useNavigate();
|
|
|
|
useEffect(() => {
|
|
// Set a timer for 5 seconds (5000 milliseconds)
|
|
const timer = setTimeout(() => {
|
|
// Navigate to the target page after the timer expires
|
|
onChanged(data.goTo-1)// Change '/targetPage' to your desired route
|
|
}, 3000);
|
|
|
|
// Cleanup the timer on component unmount
|
|
return () => clearTimeout(timer);
|
|
}, [navigate]);
|
|
|
|
return (
|
|
<div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default TransitionPage;
|