DEV Community

Discussion on: POST FormData to JSON object array with ReacStrap Form and Express

Collapse
 
techfortified profile image
Peter Kelvin Torver

When you create an instance of FormData you need to append data to the formData object. I have seen your issue on Stack overflow.
Use this solution

const data = new FormData()
data.append("username", username)

// Go ahead and append all your variables
Enter fullscreen mode Exit fullscreen mode

On your Nodejs server, if you're not sending a file along with your form, do not send form data content-type to the server. Use json instead