(feat) add redirect to home for handle navigate to / without remove params

This commit is contained in:
alij
2024-11-10 18:14:07 +03:30
parent 52b2e30698
commit 672a765ede

View File

@@ -0,0 +1,18 @@
import { useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";
const RedirectToHome = () => {
const navigate = useNavigate();
const location = useLocation();
useEffect(() => {
navigate({
pathname: "/",
search: location.search,
});
}, [navigate, location.search]);
return null;
};
export default RedirectToHome;