@react-hook/resize-observer
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "@react-hook/resize-observer", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/jaredLunde/react-hook/tree/master/packages/resize-observer#readme", | ||
@@ -5,0 +5,0 @@ "repository": "github:jaredLunde/react-hook", |
@@ -58,5 +58,5 @@ <hr> | ||
if (!size && target) { | ||
setSize(target.getBoundingClientRect()) | ||
} | ||
React.useLayoutEffect(() => { | ||
setSize(target.current.getBoundingClientRect()) | ||
}, [target]) | ||
@@ -72,3 +72,3 @@ // Where the magic happens | ||
return ( | ||
<pre ref={setTarget}> | ||
<pre ref={target}> | ||
{JSON.stringify({width: size.width, height: size.height}, null, 2)} | ||
@@ -75,0 +75,0 @@ </pre> |
19483