Skip to content

Instantly share code, notes, and snippets.

@pedroparra
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save pedroparra/0700e661f6a29260264f to your computer and use it in GitHub Desktop.

Select an option

Save pedroparra/0700e661f6a29260264f to your computer and use it in GitHub Desktop.
React Js shouldComponentUpdate
// Ecmascript 5
var MyComponent = React.createClass({
shouldComponentUpdate: function(next_props, next_state) {
return false;
}
// Despues del primer render, nunca volver a renderizarse.
render: function() {
<div>Soy un component</div>
}
});
// Ecmascript 6
class MyComponent extends React.Component {
shouldComponentUpdate: (next_props, next_state) {
return false;
}
// Despues del primer render, nunca volver a renderizarse.
render(){
<div>Soy un component</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment