Created
May 19, 2017 06:02
-
-
Save cheton/cf244310724a4f590d6e870bcef0c8e8 to your computer and use it in GitHub Desktop.
xxxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Widget widgetId="threats" /> | |
// ES7 class properties | |
class Widget extends React.Component { | |
state = this.getInitialState(); // ? | |
getInitialState() { | |
return { | |
widgetId: this.props.widgetId | |
}; | |
} | |
} | |
// ES6 class constructor | |
class Widget extends React.Component { | |
constructor() { | |
super(); | |
this.state = this.getInitialState(); // ? | |
} | |
getInitialState() { | |
return { | |
widgetId: this.props.widgetId | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment