fix(use-window-size): default value

This commit is contained in:
RadoslavDimchev 2024-02-01 20:47:56 +02:00 committed by Radoslav Dimchev
parent 0dc78ef076
commit cfa34de8cc
1 changed files with 5 additions and 2 deletions

View File

@ -1,10 +1,13 @@
import { useState, useEffect } from 'react'
export const useWindowSize = () => {
const [size, setSize] = useState({ width: 0, height: 0 })
const [size, setSize] = useState({
width: window.innerWidth,
height: window.innerHeight,
})
useEffect(() => {
function handleResize() {
const handleResize = () => {
setSize({
width: window.innerWidth,
height: window.innerHeight,