Dropdown doesn't close on click outside fix

Hi there,

Dropdown component doesn't close on click outside in my app. 
I debugged a little bit problem and found that componentWillUpdate uses incorrect.
It accepts nextProps and nextState and not prevState and nextState
https://facebook.github.io/react/docs/component-specs.html#updating-componentwillupdate
old
Rodion 2016-02-18 20:15:13 +02:00 committed by Javi Velasco
parent d8a58bd225
commit c1f2b83865
1 changed files with 2 additions and 2 deletions

View File

@ -34,8 +34,8 @@ class Dropdown extends React.Component {
up: false
};
componentWillUpdate (prevState, nextState) {
if (!prevState.active && nextState.active) {
componentWillUpdate (nextProps, nextState) {
if (!this.state.active && nextState.active) {
events.addEventsToDocument({click: this.handleDocumentClick});
}
}