Skip to content
Snippets Groups Projects

handle go back events

1 file
+ 6
0
Compare changes
  • Side-by-side
  • Inline
+ 6
0
@@ -41,6 +41,8 @@ export default function App() {
}, [reload]);
useEffect(() => {
window.addEventListener("popstate", () => setReload(true));
let path = window.location.pathname.split("/");
if (restaurantsList && path.length >= 2 && path[1]) {
let name = decodeURIComponent(path[1]);
@@ -48,7 +50,11 @@ export default function App() {
if (filter) {
setSelection(filter[0]);
}
} else {
setSelection(null);
}
return () => window.removeEventListener("popstate", () => setReload(true));
}, [restaurantsList]);
useEffect(() => {
Loading