mirror of
https://github.com/usememos/memos.git
synced 2025-11-09 17:01:36 +08:00
* refactor: add bi-directional filters sync between filterStore and searchParams * fix: tag redirection from memos detail page, https://github.com/usememos/memos/issues/4232
20 lines
518 B
TypeScript
20 lines
518 B
TypeScript
import { NavigateOptions, useNavigate } from "react-router-dom";
|
|
|
|
const useNavigateTo = () => {
|
|
const navigateTo = useNavigate();
|
|
|
|
const navigateToWithViewTransition = (to: string, options?: NavigateOptions) => {
|
|
const document = window.document as any;
|
|
if (!document.startViewTransition) {
|
|
navigateTo(to, options);
|
|
} else {
|
|
document.startViewTransition(() => {
|
|
navigateTo(to, options);
|
|
});
|
|
}
|
|
};
|
|
|
|
return navigateToWithViewTransition;
|
|
};
|
|
|
|
export default useNavigateTo;
|