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

234
Views
how do I make a math Django and react web application?

Hope all is well.

I want to have an input field in my react frontend that takes in a math expression (e.g 1 + 1) and I want my backend to respond with the answer 2.

How do you do this using reactjs and Django?

So far I have some of the frontend finished:

it will send the input data to the backend using the API url.

import  React, {useState, UseEffect } from 'react';

function Home() {
    const [query, setQuery] = useState("");

    return (
        <div className='Home'>
            <form action={APIL_URL} method="POST">
                <input name="linear-algebra-expression"
                       id="linear-algebra-expression"
                       type="text"
                       onChange={e => setQuery(e.target.value)}
                       value={query}>
                </input>
            </form>
        </div>
    )
}

export default Home;

I am aware that in my Django backend I am going to have something like:

class LinearAlgebraView(APIView):
    def post(self, request):
        expression = request.POST['linear-algebra-expression']

        return (... ?)

I want to be able to return the computed data from Django to react at the samne web page where the user entered the math expression in the form/input. How do I do this?

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you could just use eval() method witch taking a string as parameter and return the computed value like for exemple :

linear-algebra-expression = "3-1 + 12/10"
result = eval(linear-algebra-expression)
print(" 3-1 + 12/10 = " + str(result))

output: 3-1 + 12/10 = 3.2

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!