Last active
August 29, 2015 14:27
-
-
Save pedroparra/0700e661f6a29260264f to your computer and use it in GitHub Desktop.
React Js shouldComponentUpdate
This file contains hidden or 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
| // 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