Check out example codes for "kill rails". It will help you in understanding the concepts better.

Code Example 1

lsof -wni tcp:3000
kill -9 PID

Learn ReactJs, React Native from akashmittal.com