Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cameronbourke/284de4dcd762c83dd5cb538403cc7be1 to your computer and use it in GitHub Desktop.
Save cameronbourke/284de4dcd762c83dd5cb538403cc7be1 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
import Perf from 'react-addons-perf';
import { range } from 'ramda';
window.Perf = Perf;
Perf.start();
class Foo extends React.Component {
constructor () {
super();
// this.handleClick = this.handleClick.bind(this)
}
handleClick () {
//
}
render () {
return (
<div onClick={this.handleClick.bind(this)}>
{"Foo"}
{this.props.children || null}
</div>
);
}
}
class Bar extends React.Component {
constructor () {
super();
// this.handleClick = this.handleClick.bind(this)
}
handleClick () {
//
}
render () {
return (
<div onClick={this.handleClick.bind(this)}>
{"Bar"}
{this.props.children || null}
</div>
);
}
}
const App = () => (
<div>
{range(0, 50).map((num, i) => {
return (
<Foo>
{range(0, 20).map((num, i) => {
return (
<Bar>
<Foo />
</Bar>
)
})}
</Foo>
);
})}
</div>
);
const render = () => {
ReactDOM.render(
<App />,
document.getElementById('root')
);
};
render();
for (let i = 0; i < 50; i++) {
render();
}
Perf.stop();
const measurements = Perf.getLastMeasurements();
Perf.printInclusive(measurements);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment