---
title: "Discussion on \"Understanding the Power of useRef: Preventing Infinite Renders and Differences from useState in React\" | Hashnode"
description: "Discussion on \"Understanding the Power of useRef: Preventing Infinite Renders and Differences from useState in React\". Enhancing React Efficiency: Preventing Infinite Renders with useRef"
url: "https://hashnode.com/posts/understanding-the-power-of-useref-preventing-infinite-renders-and-differences-from-usestate-in-react/64e7637091e7499d92c5e678"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Understanding the Power of useRef: Preventing Infinite Renders and Differences from useState in React](https://debasmitbiswal.hashnode.dev/understanding-the-power-of-useref-preventing-infinite-renders-and-differences-from-usestate-in-react?utm_source=hashnode&utm_medium=feed)

Enhancing React Efficiency: Preventing Infinite Renders with useRef

Aug 24, 2023 · 3 min read · debasmitbiswal.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Debasmit Biswal](https://hashnode.com/@Deb1)

@Deb1 · Bengaluru

  
[View profile](https://hashnode.com/@Deb1)

I am currently open for SDE roles

## Responses 1

Markdown supported · ⌘↵ to post

[Anwar Hossain](https://hashnode.com/@anwarhossain)

[Aug 25, 2023](https://hashnode.com/posts/understanding-the-power-of-useref-preventing-infinite-renders-and-differences-from-usestate-in-react/64e7637091e7499d92c5e678/comment/64e8350dd47513fefda68215)

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.

[Debasmit Biswal](https://hashnode.com/@Deb1)

[Aug 25, 2023](https://hashnode.com/posts/understanding-the-power-of-useref-preventing-infinite-renders-and-differences-from-usestate-in-react/64e7637091e7499d92c5e678/comment/64e8350dd47513fefda68215#reply-64e8366dcddf12fecdfca8b9)

If you want to render it you can pass the dependency in useEffect. useRef will render once every time if the dependency of useEffect changes. As a result you can see the latest value accordingly.
