import { useEffect } from "react";
import { useLocation } from "react-router-dom";

import { scrollTo } from "@devowl-wp/react-utils";

import type { FC } from "react";

const RouterScrollToTop: FC = () => {
    const location = useLocation();
    useEffect(() => {
        scrollTo(0);
    }, [location.pathname]);

    return null;
};

export { RouterScrollToTop };
