Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

316
Views
Send React Form Input to Flask

I am trying to send user input from a React form to a flask server when the user presses the submit button. How can I receive the form data from my Flask server and display it? Here is my javascript and python code:


class LineChart extends Component {

render() {

        return (

<form onSubmit={this.handleSubmit} method="post" >
                    <input type="text" id='startDate' />
                    <br></br>
                    <input type="text" id='endDate' />
                    <br></br>
                    <input type='submit' value='submit' />
</form>
)}
}
from flask import Flask

app = Flask(__name__)

@app.route("/acceptDates", methods=['POST'])
def get_dates():
#how do i implement this method


@app.route('/')
def index():
    return "<h1 > Home Page </hi>"

if __name__ == '__main__':
    app.run(debug = True)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

from flask import Flask, request

app = Flask(__name__)

@app.route("/acceptDates", methods=['POST'])
def get_dates():
    #Try this code
    startDate = request.form.get('startDate')
    endDate = request.form.get('endDate')

@app.route('/')
def index():
    return "<h1 > Home Page </hi>"

if __name__ == '__main__':
    app.run(debug = True)

Please check this answers. Click Here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!