I'm receieving an array from a Express back-end running with a MongoDB and am currently retrieving an array with the .toArray() function, everything's fine on the back-end.
So the issue is when I'm receieving the array on the front-end, I'm trying to pass it onto state with setState function and it gives me this error
Error: Objects are not valid as a React child (found: object with keys {_id, uploaderId, uploaderName, title, subtitle, description, language, category, subcategory, currency, price, contents, likes, dislikes, coverImage, coverVideo}). If you meant to render a collection of children, use an array instead.
And the actual code is looking like this
axios({
url: "/course/data",
method: "GET",
params: {id: userInfo._id},
}).then(response => {
userInfo.courses = response.data;
console.log(userInfo);
this.setState(userInfo);
}).catch(err => err ? alert(err) : null);