Skip navigation
A cure for React useState hell?
0:00 / 2:22

A cure for React useState hell?

Steve (Builder.io)

@Steve8708139K followers

Visit on X
5,463 likesDownloadOriginal post

609,454 views

A cure for React useState hell? You may not realize how easily you can replace useState with useReducer and simplify your state management You can read more in my latest blog post:

10 Comments

Comments from the original post on X (Twitter)

  • Steve (Builder.io)'s profile picture

    @Steve8708

    Huge kudos to @DavidKPiano for first pointing this out in his epic thread:

    75 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    If you are interested in this topic and want to read further, I go into more detail in my blog post:

    50 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    And follow @DavidKPiano - he is the creator of XState and @statelyai and posts tons of great content and tips on state management patterns

    9 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    Also if you are a fan of YouTube I’ve started posting videos there as well

    9 likes

  • Marton Sari's profile picture

    @sarimarton

    To me it makes no sense to do validation like that. The pattern you reach with this is silent errors all around. If you want user input validation, you do it with an explicit mechanism with feedback (client/server/isomorph). If you want dev consistency, you do it on type level.

    20 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    Generally speaking, imo you should have both

    2 likes

  • Erik Rasmussen 👨‍💻🇺🇸🇪🇸's profile picture

    @erikras

    @DavidKPiano This is super cool. I feel like you made a typo in the video (and blog post). Surely this should be `Math.min(next, 10)`, right?

    13 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    @DavidKPiano Doh, yes, thank you!

    5 likes

  • Vibbs Dod's profile picture

    @Vibbsdod

    Have you checked out Learnt about it from new react beta docs, might help with pain points that you are talking about.

    12 likes

  • Steve (Builder.io)'s profile picture

    @Steve8708

    Wrote about this in the blog post, Immer is amazing

    1 like