React js Performance tool addon throws "Cannot read property 'counts' of undefined"

javascript, performance, reactjs

Solution

See https://github.com/facebook/react/issues/3389#issuecomment-79236067.

It looks like `Perf.start()` only works if it is called outside of the component lifecycle. So, call it before you start your application, or call it directly from the browser's console before you trigger the event you're trying to monitor.

Problem

I've confused as to how to utilize React's performance tool. My current usage is shown below: ``` var Perf = React.addons.Perf; Perf.start(); this.setState({ newState: newStateObject, }, function(){ Perf.printInclusive(); Perf.stop(); }); ``` This doesn't render anything on the page and blurts out ``` Uncaught TypeError: Cannot read property 'counts' of undefined ```

Original source