How to add class in element on scroll React js, I want to add class in on scroll and remove that class if on top of the page.
import React from "react"
import { Link } from "react-router"
import { prefixLink } from "gatsby-helpers"
import Helmet from "react-helmet"
import { config } from "config"
module.exports = React.createClass({
propTypes() {
return {
children: React.PropTypes.any,
}
},
render() {
window.addEventListener('scroll', (event) => {
});
return (
<div>
<header className="header">
<div className="top-bar">
<span><a href="tel:6788272782">678-827-2782 </a></span>
<span><a href="mailto:hellohello@knotel.com"> hellohello@knotel.com</a></span>
<button>Login</button>
</div>
</header>
{this.props.children}
</div>
)
},
})