Skip navigation
❌ Avoid multiple state variables to track status.
0:00 / 0:22

❌ Avoid multiple state variables to track status.

George Moller

@_georgemoller118K followers

Visit on X
1,764 likesDownloadOriginal post

152,470 views

❌ Avoid multiple state variables to track status. ✅ Instead use enums.

8 Comments

Comments from the original post on X (Twitter)

  • statuscast's profile picture

    @statuscast

    Help your IT team cut through 'Are you down?' clutter with StatusCast’s Audience Specific Status Pages. Tailor your status page to each user's role and needs for effective incident communication.

    1,003 likes

  • Roushou (e/acc)'s profile picture

    @roushou_

    Even better to use a union string

    10 likes

  • FullStackIzzy's profile picture

    @fullstackizzy

    George, I definitely need to try your implementation. Because this can't be life. I apologize for my code below🤦‍♂️:

    4 likes

  • Marcelo Terreiro's profile picture

    @marceloterreiro

    Holy crap don’t do this. Why enums if you can you a string literal lol

    4 likes

  • Alexandru Corut's profile picture

    @AlexandruCorut

    Nice, but what’s the error.message?

    2 likes

  • Pavel Romanov's profile picture

    @pavl_ro

    If it is only possible to have one of the states at a time, then it is a way to go 👌 It's also much easier to work with a single state than with all those boolean logic conditions mixed into the component.

    1 like

  • Alessandro's profile picture

    @aless_133

    It's not enum

    1 like

  • Dika's profile picture

    @dikaizm

    It only records status, how do you save the value of error message?