From be2dd9bef9fcd28aecd3d07d52fd763dabf70a7f Mon Sep 17 00:00:00 2001 From: Mika Nevalainen Date: Wed, 11 May 2022 17:11:05 +0300 Subject: [PATCH] Call updateState to ensure useMobile hook to initialize state --- packages/react/src/hooks/useMobile.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/hooks/useMobile.tsx b/packages/react/src/hooks/useMobile.tsx index 86d3738004..beb2141108 100644 --- a/packages/react/src/hooks/useMobile.tsx +++ b/packages/react/src/hooks/useMobile.tsx @@ -10,6 +10,7 @@ export const useMobile = (): boolean => { const updateState = () => setIsMobile(checkIfMobile()); window.addEventListener('resize', updateState); + updateState(); return () => window.removeEventListener('resize', updateState); }, []);