<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj" -->

---
title: Why you shouldn’t always use “useState” | daily.dev
description: UseRef has the same power of persistence that useState has. It sustains the value through the component’s life-cycle, but the cool part is that it is...
canonical: https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why you shouldn’t always use “useState” | daily.dev
og:description: UseRef has the same power of persistence that useState has. It sustains the value through the component’s life-cycle, but the cool part is that it is...
og:url: https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj
og:image: https://api.daily.dev/og/posts/DaCi3z6mj.png
og:image:alt: Why you shouldn’t always use “useState”
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why you shouldn’t always use “useState”

**[JavaScript in Plain English](https://daily.dev/sources/jsPlainEnglish)** · 3 min read · 110 upvotes · 2 comments

## Summary

UseRef has the same power of persistence that useState has. It sustains the value through the component’s life-cycle, but the cool part is that it is synchronous. When I need to do something immediately and I need it for the flow of my code, then I aim for useRef.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://javascript.plainenglish.io/why-you-shouldnt-always-use-usestate-658994693018?source=rss----4b3a1ed4f11c---4>

## Community discussion

Top comments from developers on daily.dev.

**@brunogonzales** · 2 upvotes

> or use vue

**@blankfella** · 1 upvotes

> TLDR; guy gets butthurt, goes and writes article about useState vs useRef vs using a variable. Interesting to see the difference between the first two.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

[View this post on daily.dev](https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Why you shouldn’t always use “useState”","url":"https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj"},"datePublished":"2022-03-17T16:24:50.011Z","dateModified":"2022-03-17T16:24:50.011Z","description":"UseRef has the same power of persistence that useState has. It sustains the value through the component’s life-cycle, but the cool part is that it is...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1afb2019ef137d420af534e0c1ac8858","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1afb2019ef137d420af534e0c1ac8858","isAccessibleForFree":true,"articleSection":"JavaScript in Plain English","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"JavaScript in Plain English","logo":"https://media.daily.dev/image/upload/s--Dg5QTRuI--/f_auto,q_auto/v1686665538/logos/pe","url":"https://daily.dev/sources/jsPlainEnglish"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":110},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"JavaScript in Plain English","item":"https://daily.dev/sources/jsPlainEnglish"},{"@type":"ListItem","position":3,"name":"Why you shouldn’t always use “useState”"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/why-you-shouldn-t-always-use-usestate--daci3z6mj","comment":[{"@type":"Comment","text":"or use vue","datePublished":"2022-03-23T21:42:24.233Z","url":"https://daily.dev/posts/DaCi3z6mj#c-xNgTHtGqm","author":{"@type":"Person","name":"Bruno Gonzales","url":"https://daily.dev/brunogonzales","image":"https://avatars3.githubusercontent.com/u/57231813?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"TLDR; guy gets butthurt, goes and writes article about useState vs useRef vs using a variable. Interesting to see the difference between the first two.","datePublished":"2022-05-26T09:53:48.545Z","url":"https://daily.dev/posts/DaCi3z6mj#c-NUZ-8tPK0","author":{"@type":"Person","name":"Youssef I.","url":"https://daily.dev/blankfella","image":"https://lh3.googleusercontent.com/a-/AOh14GisKmZVkdQBZi8qRxo9LutpgednCJTJmQbd9G_yj2s=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

