DEV Community

Discussion on: I've released over 100 apps in React Native since 2015, Ask Me Anything!

Collapse
 
insomniac807 profile image
Philip Butler

let string = "alert('injection success'); var data = "+this.state.data;
this.webview.current.injectJavaScript(string);

Why is it that the alert runs fine but I cant access the variable data from the html template being rendered by the webview?

I try to call it in the script tag like this

document.addEventListener("DOMContentLoaded", function(event) {
alert(data);
});