This is an interesting question, and it depends on how you define the UI state.
Victor Savkin

In this particular example, I’m trying to determine whether to display a loading icon, the successful result, or the error result.

The solution that I came up with was having an enum that reflects these states stored on the component, and updating that:

  • Initial load or reloads changes UI state Loading
  • Successful load changes UI state to Succeeded
  • Error load changes UI state to Failed

That sounds like what you are suggesting, I just didn’t know if there was a more elegant solution.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.