Check out example codes for "swift javascript injection". It will help you in understanding the concepts better.
Code Example 1
let js = "var myelement = document.getElementById(\"test\");myelement.innerHTML= \"New Text\";"
webView.evaluateJavaScript(js, completionHandler: nil)
Learn ReactJs, React Native from akashmittal.com