ctrlplusb / react-component-queries

Provide props to your React Components based on their Width and/or Height.
MIT License
183 stars 12 forks source link

Once/When option? #76

Open ericclemmons opened 7 years ago

ericclemmons commented 7 years ago

I'm sure this isn't how you'd like to ideally handle this, but I'm using this project within react-storybook and noticed that when I resize the window, the component constantly resizes.

I don't know if this is due to margins/padding calculation or what.

Basically, the usage I'm going for is waiting for width/height calculation for the initial render of the component, then not worrying about the resize event at all anymore. (i.e. the size is only necessary for initial rendering of the layout)

ctrlplusb commented 7 years ago

An interesting suggestion! I am holiday'ing with the fam at the moment, but will give this some thought after the 26th.