I have been looking forward to connecting the frontend(ReactJS) with backend(python) using Flask and axios. How can i post something on the Flask app using axios from React JS?
Asked
Active
Viewed 1,115 times
1 Answers
3
Something like:
axios.post(link_to_your_flask_app_route, {
firstName: 'yacine',
lastName: 'mahdid'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
There is plenty of documentation on this: axios cheatsheet One thing to keep in mind is that your backend doesn't matter. It can be Flask, Django or whatever, you are simply making a Post to a remote API.

Yacine Mahdid
- 723
- 5
- 17
-
Thanks for the answer..can u plz give an example on how i can create a post on flask? – Ani Dec 22 '19 at 04:14
-
I dont want to just post it on console but also post it on the flask server. – Ani Dec 22 '19 at 05:06