The back-end generated the data API, and how to fetch data on the front end ps: I use react
URL: http://localhost:8080/api/barrages
{
"content": [
{
"key": 12344443434545435,
"text": "绿色走一波",
"time": 500,
"fontFamily": null,
"fontsize": null,
"color": "#0f0",
"video_id": null,
"creationDateTime": "2019-04-08T13:59:51Z"
}
],
"page": 0,
"size": 30,
"totalElements": 1,
"totalPages": 1,
"last": true
}
fetch("/api/barrages", { method: 'GET' })
.then(function (res) {
res.json()
.then(function (barrage) {
console.log(barrage);
}
)
})
I want to get the data of content
You would need to do it like this:
fetch("/api/barrages", { method: 'GET' })
.then(function (res) {
return res.json()
}
.then(function(myJson){
console.log(JSON.stringify(myJson))
})
})
I'm not able to pass the state value to the method or function in React [closed]
How to access array index of Cloud Firestore using query in Flutter?
Getting an unwanted space between Nav Items in Navbar Angular
PHP Script INSERT INTO SELECT does not insert, with no errors [closed]
SQL query to select students who have taken all subjects from subjects table
Displaying Dynamic placeholder content on Textbox in ReactJS
Extracting Parameters from Redirect URI - QuickBooks API / Python
I have setup an uploader, which can upload multiple files at once and currently shows you the progress of file being uploadI would like to show the progress of every file
i am trying to create post request and passing some values like name,password, Head (checkbox) and email in thatI want to another request based on some condition which is,
This question already has an answer here:
In REACT JS, I have a JSON object in state component "myrecords" where items are grouped by their Company Names and it has following format: