AH
There is an issue with the process. If UI doesn't rerender, we will not be able to see the latest value of the count variable by using useRef. As a result, with the increment and decrement value of the count will be updated but for not rerendering the ui, we won't see it's latest value.
CommentArticleAug 25, 2023Understanding the Power of useRef: Preventing Infinite Renders and Differences from useState in React