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
| function pureRenderMixin(Component) { | |
| Component.prototype.shouldComponentUpdate(nextProps, nextState) { | |
| return !shallowEqual(this.props, nextProps) || | |
| !shallowEqual(this.state, nextState); | |
| } | |
| return Component; | |
| } | |
| class MyComponent extends React.Component {} |
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
| if ( | |
| process.env.NODE_ENV === 'production' && | |
| window.__REACT_DEVTOOLS_GLOBAL_HOOK__ && | |
| Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers).length | |
| ) { | |
| window.__REACT_DEVTOOLS_GLOBAL_HOOK__._renderers = {} | |
| } |
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
| // Production steps of ECMA-262, Edition 6, 22.1.2.1 | |
| // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from | |
| if (!Array.from) { | |
| Array.from = (function () { | |
| var toStr = Object.prototype.toString; | |
| var isCallable = function (fn) { | |
| return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; | |
| }; | |
| var toInteger = function (value) { | |
| var number = Number(value); |
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
| import React from "react"; | |
| import { render } from "react-dom"; | |
| const ParentComponent = React.createClass({ | |
| getDefaultProps: function() { | |
| console.log("ParentComponent - getDefaultProps"); | |
| }, | |
| getInitialState: function() { | |
| console.log("ParentComponent - getInitialState"); | |
| return { text: "" }; |
NewerOlder