Check out example codes for "this site can’t be reachedlocalhost unexpectedly closed the connection. .net framework". It will help you in understanding the concepts better.

Code Example 1

Open this in your browser: chrome://net-internals/#hsts
Go to Delete domain security policies
Enter "localhost"
Restart browser

Learn ReactJs, React Native from akashmittal.com