We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5e2752 commit 60bf3eeCopy full SHA for 60bf3ee
src/components/hooks/useSafeNavigate/index.js
@@ -42,5 +42,13 @@ export default function useSafeNavigate() {
42
}
43
44
45
- return { redirectTo }
+ const goBack = () => {
46
+ if (window.history.length > 1) {
47
+ navigate(-1)
48
+ return
49
+ }
50
+ redirectTo('/')
51
52
+
53
+ return { redirectTo, goBack }
54
src/hooks/useSafeNavigate.js
@@ -40,5 +40,13 @@ export default function useSafeNavigate() {
40
41
+ startTransition(() => navigate(-1))
0 commit comments