diff --git a/src/index.tsx b/src/index.tsx index 607396d..7f7d1c0 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -16,7 +16,7 @@ export interface Props { const VisibilitySensor: React.FC = (props) => { const myView: any = useRef(null); - const [lastValue, setLastValue] = useState(false); + const [lastValue, setLastValue] = useState(null); const [dimensions, setDimensions] = useState({ rectTop: 0, rectBottom: 0, @@ -26,7 +26,6 @@ const VisibilitySensor: React.FC = (props) => { let interval: any = null; useEffect(() => { - setLastValue(false); startWatching(); isInViewPort(); return stopWatching;