I built an app where the port number of the API can be configured. The user can set a new port number. If the port number is not valid, the API call will hang for 100 seconds! I wanted to introduce a feature where the API call times out in 10 seconds.

Before I started to work on this task, I did not know that the fetch specification does not have a timeout option.…

Read More

When we are dealing with form input, we need to cancel navigation to a different page to ensure that the form is saved. This is a bit tricky than it sounds. How should the app behave if the user

  1. Closes the browser.
  2. Moves to a different website.
  3. Moves to another page within the same website.

Navigating to a different site or closing the browser

There is not much that a React app can do to handle the cases 1.…

Read More