State is like
state = {
courseTitle: "",
courseImage: "",
duration: "",
overView: "",
syllabus: [
{
title: "",
description: "",
},
],
};
And I'm submitting data using FormData() because i have image too
handleSubmit = (e) => {
e.preventDefault();
const fd = new FormData();
fd.append("courseTitle", this.state.courseTitle);
fd.append("courseImage", this.state.courseImage);
fd.append("duration", this.state.duration);
fd.append("overView", this.state.overView);
fd.append("syllabus", this.state.syllabus);
this.props.addCourse(fd);
};
Everythings is fine except syllabus because it is in array, FormData send a value of syllabus,
syllabus:[object object]
Please Can anyone help me on how to send Array Data with the above state format, I'm using react and redux for backend nodejs, express and mongodb