export default function useCustomNavigate() {
  return (path, { replace = false, state = null, reload = false } = {}) => {
    if (reload) {
      if (replace) {
        window.location.replace(path);
      } else {
        window.location.href = path;
      }
      return;
    }

    const historyState = { ...state };
    if (replace) {
      window.history.replaceState(historyState, "", path);
    } else {
      window.history.pushState(historyState, "", path);
    }
    //ssss
    window.dispatchEvent(new PopStateEvent("popstate"));
  };
}
