How to send form data from react to express

Hello geeks! In this post I have shared the details about “How to send form data from react to express”. Okay, let’s move on to the article.

How to send form data from react to express

const reactData = [ id: 1, name:' Tom',  id: 2, name:' Sarah'];
const url = localhost:4000/api/users/register;

let sendData = () => 
axios.post(url, reactData)
   .then(res => console.log('Data send'))
   .catch(err => console.log(err.data))
const url = localhost:4000/api/users/register;
const usersData= [];

let getData = () => 
axios.get(url)
   .then(res => usersData.push(res.data))
   .catch(err => console.log(err.data))

Final Words

I hope this post helps you to know about “How to send form data from react to express”. If you have any questions regarding this post please let us know via the comment section. Share this article with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment