pageYOffset Not Working in React
<p>I have a full screen landing page, and I want to know when that screen is full scrolled out, so I can bring in and fix the <code>navbar</code>. I am managing to get the hight of the device/window, but I can't get <code>pageYOffset</code> to fire of.</p>

<p>Here is my code:</p>

<pre><code>export default class NavbarComp extends Component {
  constructor() {
   super();
   this.state = {
    windowHight:"",
    navbarfix: ""
  };
  this.handleScroll = this.handleScroll.bind(this)
  }

getWindowHight(){
 let deviceWindow = document.getElementById('landing-section');
 let deviceWindowHight = window.getComputedStyle(deviceWindow).getPropertyValue('height');

console.log("from getinitiatlhight" + deviceWindowHight);

this.setState({
  windowHight: deviceWindowHight
  });
}

componentDidMount(){
 window.addEventListener('scroll', this.handleScroll);
 this.getWindowHight();
}

handleScroll() {
 console.log("scrolll" + this.state.windowHight);
 if (window.pageYOffset &gt;= this.state.windowHight) {
  console.log("fix");
 } else if (window.scrollY &lt; this.state.windowHight) {
  console.log("unfix" );
 }
}
</code></pre>