I got an array with objects and they're values.
Is it possible to extract all object values without doing this every time: Array[objnumber].value
?
Here is how it looks in mongoDB: https://gyazo.com/a4a6702ef0546609ea231de299ee62fd
Here is what data looks like
{
"date":[
{
"title":"Unavaible",
"start":"2020-05-19",
"end":"2020-05-22"
},
{
"title":"Unavaible",
"start":"2020-05-28",
"end":"2020-05-29"
},
{
"title":"Unavaible",
"start":"2020-05-29",
"end":"2020-05-31"
}
]
}
I just used JSON.stringify to accomplish it.
Code:
const responses = response.data.date
const stringify = JSON.stringify(responses);
this.setState({
undates:[stringify]
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.