how to use ahook's useSize(document.documentElement)?
Answered
Havana posted this in #help-forum
HavanaOP
Hi, i'm having major issues understanding how i'm supposed to even do this. If i use document, i get document the document doesn't exist error. If i check like this:
useSize(document?.documentElement || null) i get hydration errors... What am i supposed to do here and why does it have to be so difficult?
useSize(document?.documentElement || null) i get hydration errors... What am i supposed to do here and why does it have to be so difficult?
1 Reply
Giant panda
Try to use if window is not null or undefined
Answer