0

I want to measure 'interactions' in our react application. For example measuring the time it takes from the moment a button is clicked (and calls some method which modifying the state) and until the result is rendered on the screen. I read today many articles about it, and understood that using the "componentDidUpdate" is not correct, and its only signaling about the step when the react it 'asking' the DOM to render, but not really actually re-painted in the screen.

Found that answer answer, but it doesn't look correct. From React documentation:

setState() does not always immediately update the component. It may batch or defer the update until later. This makes reading this.state right after calling setState() a potential pitfall. Instead, use componentDidUpdate or a setState callback (setState(updater, callback)), either of which are guaranteed to fire after the update has been applied

So from that, I understand that's the callback will be called once the actual state will be changed, but it doesn't mean that it will be called when the change will be also painted on the screen.

**Is there any option to achieve that goal ?

Ronen B
  • 15
  • 4

0 Answers0