Trying a very simple thing, and am getting errors "TypeError: Cannot read property 'counts' of undefined"
Here's the hello world example code.
https://gist.github.com/joshuacalloway/ae5b184c485956314d1c
I know this question is old - but in case someones fall in here (as I did) here it's how you should do it nowdays..
You import the react addon you want separately
import Perf from 'react-addons-perf'
and then you can do whatever you want with it.. Example: Assign it to the window object so you can use it in the console.
window.Perf = Perf
I was getting the same error calling Perf.start() in the render function where I wanted to start profiling, seemed to be a timing issue, so I just started recording perf before I rendered anything and then called my print functions when I wanted to see what was going on (pseudocode):
In app.js:
//var React = require('react'); // DONOTCHECKIN
var React = require('react/addons');
// ...
function run() {
// DONOTCHECKIN
window.Perf = React.addons.Perf; // save for later console calls
React.addons.Perf.start();
// ...
Then in the console I can invoke:
Perf.printWasted()
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With