-
Notifications
You must be signed in to change notification settings - Fork 18
As HOC #1
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
Comments
I think using decorators like: @windowResize
class MyComponent extends Component {
onWindowResize ({windowHeight, windowWidth}) {
this.setState({
fontSize: windowHeight > windowWidth ? '50vw' : '50vh'
})
}
// ...
} Would be a nice touch, as the component way feels a bit strange. Example usage of the decorator patten in another library I use: @Keydown
class MyComponent extends Component {
componentWillReceiveProps ({keydown}) {
if ( keydown.event ) {
// ...
}
}
// ...
} |
@balupton @srph Guys, I am still using logic from this library, but due to deprecation warnings and inactivity I had to rewrite it. I customized it to add support for rendering children and as HOC using basic syntax. I would be interested to implement what you proposed if you would share more info. Here is source code: https://github.com/kunokdev/react-window-size-listener/blob/master/src/index.js |
I switched to Mithril from React so can no longer offer feedback |
What do you think?
The text was updated successfully, but these errors were encountered: