Moving event bindings to separate components (ideally functional components)

This commit is contained in:
James Barnsley
2019-04-18 09:03:38 +12:00
51 changed files with 15974 additions and 15456 deletions

View File

@ -10,23 +10,14 @@ class Modal extends React.Component{
constructor(props){
super(props);
this.handleKeyUp = this.handleKeyUp.bind(this);
}
componentWillMount(){
$('body').addClass('modal-open');
window.addEventListener("keyup", this.handleKeyUp, false);
}
componentWillUnmount(){
$('body').removeClass('modal-open');
window.removeEventListener("keyup", this.handleKeyUp, false);
}
handleKeyUp(e){
if (this.props.shortkeys_enabled && e.keyCode == 27){ // esc
window.history.back();
}
}
render(){