Formal Status

Loading "Formal Status"
πŸ‘¨β€πŸ’Ό Let's clean up things a little bit with what we've built so far by making the status of our promise a little more formal.
What we have now is:
  • if there's an error, throw it
  • if there's no ship, throw the promise
  • render the ship
But that's not exactly clear.
So instead, let's add a status variable that can be 'pending' | 'fulfilled' | 'rejected' (start it out with 'pending').
πŸ“œ To learn more about why this is important, read Make Impossible States Impossible and Stop using isLoading booleans

Please set the playground first

Loading "Formal Status"
Loading "Formal Status"