I am trying to display value of tinyui
from the below response object which I'm receiving from a third-party confluence API via my in-house spring-boot API.
So the high level view, for example, is:
"confluence-api"<--"spring-boot-api"<--"react-app"<---"user"
andthe JSON response is:
{
"results": [
{
"id": "xxxxx",
"type": "xxxx",
"status": "xxxx",
"title": "file",
"restrictions": {},
"_links": {
"webui": "xxx",
"tinyui": "",
"self": "xxx",
},
"_expandable": {
"container": "",
"body": "",
"version": "",
"space": "xxx"
}
},
],
"start": 0,
"limit": 25,
"size": 9,
"_links": {
"self": "",
"base": "",
"context": ""
}
}
However in my react app
import React, { Component } from "react";
import axios from "axios";
class Connect extends Component {
state = {
some:[],
results:[],
};
componentDidMount() {
const title = "sometext"
axios.get(`http://localhost:xxxx/api/PageByTitle?title=${title}`,
{
headers : {
'Content-Type': "application/json",
}})
.then((res)=> {
this.setState({ some: res.data?res.data:[]})
this.setState({results:res.data.results?res.data.results:[]})
console.log(this.state.some)
console.log(this.state.some.results)
})
.catch(err => console.log(err))
}
render (){
return(
<div>
{this.state.results.map(
(result) => <p>{result._links.tinyui}</p>
)}
</div>
)
}
}
export default Connect;
{result['_links']['tinyui']}
)} – KeepItsimple Mar 05 '21 at 21:34