Reputation: 171
I am working on integrating paytm payment service in reactjs , I am having a request from html file in nodejs I want to submit the form from react, like in react native we have an option like "WebView" so that by using the build in property "injectedJavaScript" we are able to submit the form by using the form name in nodejs.
Example (in react native):
<WebView
source={{uri: ""}}
injectedJavaScript={`document.form-name.submit()`}
/>
As we see in the above code, that can be done in react native using WebView, so I want to know do I have anything like the same in react js ? Hope you got my question
Upvotes: 0
Views: 167
Reputation: 11397
In React Native, the user is on a device, interacting with the WebView, which is an embedded browser within an app. The user is interacting through a web page, although they might not realise it.
In React, the user is in a web browser. The React equivalent of WebView is the user's browser (like Chrome, Firefox, etc). You must serve them the HTML and javascript containing your React code.
In React Native, the user opens your app. In React, the user types in your website URL (like jeraldgeorge.example.com) in their browser. In React Native, this will open your app, containing your WebView. In React, this will connect to a server you run, which must serve the same HTML that is in the WebView.
Upvotes: 1
Reputation: 51
you can use redux-form from redux and pass a redux action when the form is submitted that handles a post request to the backend(nodejs) using axios . https://redux-form.com/6.6.1/docs/gettingstarted.md/
Upvotes: 0