From 12c1303d8921cc836c0de6d405dbc2c70e4efb74 Mon Sep 17 00:00:00 2001 From: Amit Dahan Date: Fri, 8 Nov 2019 00:23:00 +0200 Subject: [PATCH] Add dependencies in browser history effect --- src/createRouter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/createRouter.js b/src/createRouter.js index d5ce8ec..8912846 100644 --- a/src/createRouter.js +++ b/src/createRouter.js @@ -75,7 +75,7 @@ export default function createRouter(routes) { }; window.addEventListener('popstate', handlePopState); return () => window.removeEventListener('popstate', handlePopState); - }); + }, [startTransition, navigate]); return ( @@ -139,4 +139,4 @@ function shouldNavigate(event) { event.button === 0 && !(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey) ); -}; \ No newline at end of file +};