Skip to content

Instantly share code, notes, and snippets.

View osanyin's full-sized avatar
🐒
Chaos dude

Rafael Guimarães osanyin

🐒
Chaos dude
  • Belo Horizonte, Minas Gerais, Brasil
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<polymer-element name="my-element">
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
@osanyin
osanyin / state.jsx
Last active April 13, 2017 02:12
React: Anatomia de um componente
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: 0};
}
incrementCount() {
this.setState({
count: this.state.count + 1
});
class Greeting extends React.Component {
render() {
return <h1>Hello {this.props.name}</h1>;
}
}
ReactDOM.render(
<Greeting name="World" />,
document.body
);
componentWillMount: function(){
this.props.onRefresh();
}
componentDidMount: function(){
this.getUserData();
}
componentWillReceiveProps: function(nextProps){
this._updateSomething(nextProps);
}
shouldComponentUpdate: function(nextProps, nextState){
return nextProps.shouldUpdate;
}
componentWillUpdate: function(nextProps, nextState){
if (nextState.bottom === this.state.bottom) {
nextState.bottom = 0;
}
}