New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useWindowSize callback #915
Comments
Keen to take this on 😄
|
@morgsmccauley great, its all yours!
Would be useful to return its state, i.e
Maybe we can use |
I'll try draft something up 👍 |
Just trying to understand things a little more:
Will appreciate any answers to these! 😄 |
If you want to do something with the window size, like some side-effect of pass the state to parent component, now you have to use const {width, height} = useWindowSize();
useEffect(() => {
// ...
}, [width, height]); with a callback it would be more direct: const {width, height} = useWindowSize({
onChange: (width, height) => {
// ...
},
});
Would need to see the code for that. |
Add ability to trigger a callback when the size is updated.
The text was updated successfully, but these errors were encountered: