<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq" -->

---
title: A cure for React useState hell? | daily.dev
description: There&#x27;s nothing preventing you from choosing an end date that’s before the start date, which makes no sense. There&#x27;s no guard for a title or description that...
canonical: https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A cure for React useState hell? | daily.dev
og:description: There&#x27;s nothing preventing you from choosing an end date that’s before the start date, which makes no sense. There&#x27;s no guard for a title or description that...
og:url: https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq
og:image: https://api.daily.dev/og/posts/KE5V_7WCq.png
og:image:alt: A cure for React useState hell?
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.

# A cure for React useState hell?

**[DEV](https://daily.dev/sources/devto)** · 6 min read · 350 upvotes · 20 comments

## Summary

There's nothing preventing you from choosing an end date that’s before the start date, which makes no sense. There's no guard for a title or description that is too long. Using useReducer, we could transform the above code, to just this: i The hook helps you control transformations from state A to state B.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/builderio/a-cure-for-react-usestate-hell-1ldi>

## Community discussion

Top comments from developers on daily.dev.

**@chronological** · 5 upvotes

> I have used `useReducer` before, and it has one major pitfall for me - it is not easy to read right away, and for me this is probably the most important thing in the code. I have to work with a lot of fullstack people who are not specialized in React and the ability to read code fast and efficiently is the biggest asset for the team. However, I am not saying that this amount of `useState()`s is good (in the article's example). If you have this kind of clutter that means that you need to refactor your component into smaller pieces before using `useReducer`.
>
> TLDR: refactor your code into...

**@dhravya** · 3 upvotes

> This legit changes everything for me.

**@andersthemagi** · 3 upvotes

> Great article, didn't know useReducer was a thing

**@lukehjo** · 2 upvotes

> Finally, something useful to see in React.

**@jmamadeu** · 2 upvotes

> Just use react-hook-form and zod!

## 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

---

Tags: [#react](https://daily.dev/tags/react)

[View this post on daily.dev](https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq)

```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":"A cure for React useState hell?","url":"https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq"},"datePublished":"2023-01-13T15:32:05.588Z","dateModified":"2023-01-13T15:32:05.501Z","description":"There's nothing preventing you from choosing an end date that’s before the start date, which makes no sense. There's no guard for a title or description that...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8793e11b2411dd45d7c6af22e59a9380","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8793e11b2411dd45d7c6af22e59a9380","isAccessibleForFree":true,"articleSection":"DEV","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":"DEV","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/devto","url":"https://daily.dev/sources/devto"},"commentCount":20,"discussionUrl":"https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":350},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":20}],"keywords":"react","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DEV","item":"https://daily.dev/sources/devto"},{"@type":"ListItem","position":3,"name":"A cure for React useState hell?"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/a-cure-for-react-usestate-hell--ke5v-7wcq","comment":[{"@type":"Comment","text":"I have used useReducer before, and it has one major pitfall for me - it is not easy to read right away, and for me this is probably the most important thing in the code. I have to work with a lot of fullstack people who are not specialized in React and the ability to read code fast and efficiently is the biggest asset for the team. However, I am not saying that this amount of useState()s is good (in the article’s example). If you have this kind of clutter that means that you need to refactor your component into smaller pieces before using useReducer.\nTLDR: refactor your code into smaller pieces with useState in them and use useReducer when you have absolutely no choice.","datePublished":"2023-01-20T16:45:49.528Z","url":"https://daily.dev/posts/KE5V_7WCq#c-DS_jfs7xK","author":{"@type":"Person","name":"Gleb","url":"https://daily.dev/chronological","image":"https://media.daily.dev/image/upload/v1594823750/placeholders/avatar.jpg"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5}},{"@type":"Comment","text":"This legit changes everything for me.","datePublished":"2023-01-16T12:36:23.863Z","url":"https://daily.dev/posts/KE5V_7WCq#c-Q5gWP4I-o","author":{"@type":"Person","name":"Dhravya Shah","url":"https://daily.dev/dhravya","image":"https://avatars.githubusercontent.com/u/63950637?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"Great article, didn’t know useReducer was a thing","datePublished":"2023-01-16T23:57:14.003Z","url":"https://daily.dev/posts/KE5V_7WCq#c-mfzcQ0uEW","author":{"@type":"Person","name":"Andres G Sepulveda Morales","url":"https://daily.dev/andersthemagi","image":"https://avatars.githubusercontent.com/u/28820236?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3}},{"@type":"Comment","text":"Finally, something useful to see in React.","datePublished":"2023-03-11T15:52:16.467Z","url":"https://daily.dev/posts/KE5V_7WCq#c-qDj99Zr95","author":{"@type":"Person","name":"LukeHjo","url":"https://daily.dev/lukehjo","image":"https://avatars.githubusercontent.com/u/60519482?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"Just use react-hook-form and zod!","datePublished":"2023-01-22T02:19:34.048Z","url":"https://daily.dev/posts/KE5V_7WCq#c-QNm88ZTzF","author":{"@type":"Person","name":"João Amadeu","url":"https://daily.dev/jmamadeu","image":"https://avatars2.githubusercontent.com/u/59426856?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}}]}
```

