I have a ReactJS front end and a flask backend and I am having difficulties making both talk to each other, particular sending form variables from the frontend to Flask.
Given below is my front end code which runs on 127.0.0.1:3000
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
class Form1 extends Component{
render(){
return(
<div class="form">
<form action="/result" method="get">
<input type="text" name="place" />
<input type="submit" />
</form>
</div>
);
}
}
ReactDOM.render(
<Form1/>,
document.getElementById('root')
);
My backend flask code is as given below and runs on 127.0.0.1:5000
from flask import Flask, render_template, request
import requests
import json
app = Flask(__name__)
@app.route('/result',methods = ['POST', 'GET'])
def result():
if request.method == 'GET':
result = request.form
print (result['place'])

<form action="127.0.0.1:5000/result" method="get"><form action="127.0.0.1:5000/result"returns anabout:blankpage.def result()does not return anything to the client. flask.pocoo.org/docs/0.12/quickstart/#routing