From 067f675f7145f246d582951ae0c16063376f9fdd Mon Sep 17 00:00:00 2001 From: manhtai Date: Sun, 5 Sep 2021 15:39:56 +0700 Subject: [PATCH] Move to useEffect --- src/components/Main.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Main.tsx b/src/components/Main.tsx index 1c69811..40fb942 100644 --- a/src/components/Main.tsx +++ b/src/components/Main.tsx @@ -172,10 +172,6 @@ const Main = () => { setSearch(e.target.value); }; - ipcRenderer.on('hotkey-pressed', () => { - history.push('/auto', { auto: true }); - }); - useEffect(() => { if (search.trim()) { setRoutes( @@ -223,6 +219,10 @@ const Main = () => { return null; }) .catch(console.error); + + ipcRenderer.on('hotkey-pressed', () => { + history.push('/auto', { auto: true }); + }); }, []); return (