fix event listener cleanup

This commit is contained in:
Sean Yesmunt 2018-10-05 14:20:28 -04:00 committed by Sean Yesmunt
parent 032ff3c250
commit 123ed44bb9

View file

@ -12,7 +12,7 @@ const ESC_KEY_CODE = 27;
type Props = {
updateSearchQuery: string => void,
onSearch: string => void,
onSearch: (string, ?number) => void,
onSubmit: (string, {}) => void,
wunderbarValue: ?string,
suggestions: Array<string>,
@ -28,10 +28,11 @@ class WunderBar extends React.PureComponent<Props> {
(this: any).handleSubmit = this.handleSubmit.bind(this);
(this: any).handleChange = this.handleChange.bind(this);
(this: any).handleKeyDown = this.handleKeyDown.bind(this);
}
componentDidMount() {
window.addEventListener('keydown', this.handleKeyDown.bind(this));
window.addEventListener('keydown', this.handleKeyDown);
}
componentWillUnmount() {