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
Number | |
Math | |
unescape | |
Object | |
Array | |
escape | |
Float32Array | |
Date | |
location | |
Int8Array |
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
Number | |
Math | |
unescape | |
Object | |
Array | |
escape | |
Float32Array | |
Date | |
location | |
Int8Array |
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
# Basic | |
Initial rendering takes ~25ms | |
Delete first takes ~30ms | |
Delete last takes ~15ms | |
Add `background: red` to the second element and delete the first, you'll see that the second element is still red. What happened is that everything moved around. The reason is that React doesn’t do the matching properly. | |
http://jsfiddle.net/vjeux/tXfDU/ |
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
# Basic | |
Initial rendering takes ~25ms | |
Delete first takes ~30ms | |
Delete last takes ~15ms | |
Add `background: red` to the second element and delete the first, you'll | |
see that the second element is still red. What happened is that everything | |
moved around. The reason is that React doesn’t do the matching properly. | |
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
var PanelList = React.createClass({ | |
// lots of stuff that front-end engineer is working on | |
render: function() { | |
// ... | |
return ( | |
<div> |
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
var Button = React.createClass({ | |
// Lots of complicated stuff | |
render: function() { | |
return ( | |
// the designer can tweak this rendering as well | |
<span style={[styles.normal, this.props.active && styles.active]} > | |
// ... | |
</span> |
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
var SomeClass = function() { | |
// constructor | |
} | |
copyProperties(SomeClass, { | |
staticMethodA: function() { | |
} | |
}) |
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
var SomeClassClosure = function() { | |
this.method = function() {} | |
} | |
new SomeClassClosure | |
// {method: fnA()} | |
new SomeClassClosure | |
// {method: fnB()} // a new fn is allocated each time | |
var SomeClassPrototype = function() {} |
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
/** | |
* Copyright 2004-present Facebook. All Rights Reserved. | |
* | |
* @providesModule deepFreezeAndThrowOnMutationInDev | |
*/ | |
/** | |
* If your application is accepting different values for the same field over | |
* time and is doing a diff on them, you can either (1) create a copy or | |
* (2) ensure that those values are not mutated behind two passes. |
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
var React = React.createClass({ | |
componentDidMount() { | |
// this.props instead of attrs | |
var xGif = this.xGif = Object.create(this.props, { | |
fire: { | |
value: function (event) { | |
console.log(event); | |
} | |
} |
OlderNewer