From a9e3bab2805b60e8d8dffd4eccfde8c05d2e6684 Mon Sep 17 00:00:00 2001 From: Vadim Dalecky Date: Sun, 7 Jul 2019 15:42:38 +0200 Subject: [PATCH] fix: iframe can be null --- src/useSize.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useSize.tsx b/src/useSize.tsx index c488e767..4079dbf4 100644 --- a/src/useSize.tsx +++ b/src/useSize.tsx @@ -45,7 +45,7 @@ const useSize = ( }; useEffect(() => { - const iframe: HTMLIFrameElement = ref.current; + const iframe: HTMLIFrameElement | null = ref.current; if(!iframe) { // iframe will be undefined if component is already unmounted