#react

React: Avoid Unnecessary Renders With Batch State Updates

React: Avoid Unnecessary Renders With Batch State Updates

February 10, 2022

Have you ever wondered why your component is re-rendering multiple time consecutively when you only expect it to re-render once? Perhaps you update some local state and somehow multiple renders occur as a result? Lets take this hooks based example: