Skip to content

Commit e36d972

Browse files
committed
Bind function in constructor.
1 parent 85fca9d commit e36d972

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/components/views/context_menus/GenericElementContextMenu.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ export default class GenericElementContextMenu extends React.Component {
2424
element: PropTypes.element.isRequired,
2525
};
2626

27+
constructor(props) {
28+
super(props);
29+
this.resize = this.resize.bind(this);
30+
}
31+
2732
componentDidMount() {
2833
this.resize = this.resize.bind(this);
29-
window.addEventListener("resize", this.resize.bind(this));
34+
window.addEventListener("resize", this.resize);
3035
}
3136

3237
componentWillUnmount() {
33-
window.removeEventListener("resize", this.resize.bind(this));
38+
window.removeEventListener("resize", this.resize);
3439
}
3540

3641
resize() {

0 commit comments

Comments
 (0)