Understanding the Power of useRef: Preventing Infinite Renders and Differences from useState in React
Introduction
React's useRef hook is a versatile tool that goes beyond its DOM manipulation capabilities. It can be harnessed to optimize performance, prevent rendering pitfalls, and manage the state in unique ways. In this article, we will explore ho...
debasmitbiswal.hashnode.dev3 min read
Anwar Hossain
I am a software engineer. I like to talk and think about Reactjs, Nextjs and Javascript. Also I like to think regarding software engineering
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.