Heyyy Marco
Heyyy Marco

Reputation: 753

React state: does changing state twice guarantees triggering render twice too?

In React: Does changing state n times also triggering render n times too?

Is there any way to ignore some state changing based on the max browser fps rate?

I'm not sure using useTransition. It seem on experimental stage.

Upvotes: 0

Views: 92

Answers (1)

Dvir Hazout
Dvir Hazout

Reputation: 261

I recommend reading this article about batch update if you mean by different state object changes. But basically, no. It doesn't guarantees triggering render n times following state change.

As for limiting it using browser fps rate - it's an interesting question. I guess it can be implemented using requestAnimationFrame the way libraries like use-debounce are implemented

Upvotes: 1

Related Questions