Skip to content

Instantly share code, notes, and snippets.

@franzejr
Last active April 27, 2016 02:07
Show Gist options
  • Save franzejr/b8422ae920e8b7df8766062a87ec2998 to your computer and use it in GitHub Desktop.
Save franzejr/b8422ae920e8b7df8766062a87ec2998 to your computer and use it in GitHub Desktop.
My Wrong Component using jQuery
var myWrongComponent = React.createClass({
changeVisibility: function(scroll){
if (scroll >= 100) {
$(".my-fixed-div").css('visibility', 'visible');
}
else{
$(".my-fixed-div").css('visibility', 'hidden');
}
},
componentDidMount: function () {
$(window).scroll(function () {
var scroll = $(window).scrollTop();
// some logic ...
}
this.changeVisibility(scroll);
}.bind(this));
},
render: function(){
return(<div className="fixed-div" />)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment