Closed scheung38 closed 5 years ago
The static
keyword can only be used with methods, you cannot use it for class properties.
class MyComponent extends Component {
constructor(props) {
super(props);
}
handleClickOutside(e) {
if (this.props.myOpened) {
this.props.toggleSubmenu(e);
}
}
render() {
return this.props.children
}
}
MyComponent.propTypes = {
toggleSubmenu: PropTypes.func.isRequired,
myOpened: PropTypes.bool.isRequired,
children: PropTypes.element.isRequired
};
const mySubmenu = onClickOutside(MyComponent)