Check out example codes for "type script encode url". It will help you in understanding the concepts better.

Code Example 1

var encodeURI = encodeURIComponent("&")

Code Example 2

var urlVar = encodeURI("This text can be passed on a url now");

Learn ReactJs, React Native from akashmittal.com