如何将jQuery滚动代码转换为ReactJS?
UIColor
答案 0 :(得分:1)
答案:
import ReactDOM from 'react-dom';
var node = ReactDOM.findDOMNode(this.refs.Headerbg);
if (node){
if (window.scrollY > 50) {
this.setState({...});
} else {
this.setState({...});
}
}