Created
April 27, 2016 02:43
-
-
Save franzejr/9dfb0be9e3f28365b837a45d53036336 to your computer and use it in GitHub Desktop.
Good Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GoodComponent = withScroll(React.createClass({ | |
getInitialState: function() { | |
return { | |
someNewState: '' | |
} | |
}, | |
componentWillReceiveProps: function(nextProps) { | |
var {scroll} = this.props; | |
// do something with scroll props | |
}, | |
render: function() { | |
var {someNewState} = this.state | |
return ( | |
<div | |
className="my-fixed-div" | |
style={{ | |
visibility: (this.props.scroll >= 100) ? 'visible' : 'hidden' | |
}} /> | |
) | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment