react-cool-dimensions: BUG: If element has zero width, entry is not defined
Bug Report
Describe the Bug
If element has zero width, entry as returned by useDimensions is undefined. Only after width is larger than 1 px, entry will be defined.
How to Reproduce
CodeSandbox Link
https://codesandbox.io/s/throbbing-water-4ujwul?file=/src/App.js
Expected Behavior
Entry should be defined with width 0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (17 by maintainers)
@wellyshen Will create a PR later today or tomorrow. Actually, I am not sure about the initialWidth/Height option - because those I could also pass into the component. What I am really looking for is a simple variable that helps me to differentiate those two special cases above. Maybe I just propose something and then you can decide (won’t be much to code anyway)