Skip to content

Instantly share code, notes, and snippets.

@brigand
Created July 12, 2015 03:10
Show Gist options
  • Save brigand/67bce134a0db7058cdf7 to your computer and use it in GitHub Desktop.
Save brigand/67bce134a0db7058cdf7 to your computer and use it in GitHub Desktop.
render(){
return (
<div>
<div className="header">
<h2>Im always diffed along with the className on my parent</h2>
</div>
<ul className="list">
{this.props.foo.map((x, i) => {
/*
React sees this:
<li className="item">
<span>foo: </span><span>{x} </span><em>(bar)</em>
</li>
Diffs li, li[className], li > *
span@1 > *
span@2 > *
em@3 > *
*/
return (
<li key={i} className="item">
foo: {x} <em>(bar)</em>
</li>
);
});
</ul>
<div className="footer">
{/* neive PureRender will always see onSomeAction as changing */
<Something
onSomeAction={(e) => this.foo()}
data={this.props.data}
/>
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment