Best regards. This is my first question. I am new to react and I do not know how to do with this doubt.
I make a request and I keep the answer in the state. Now I can't deserialize the json and use it within the app. I have tried several ways that recommend online but nothing. if I make a json.stringify, I can see the information, that is, the request is correct.
this is the request I receive from the api:
{"boards":[{"items":[{"id":"John Smith","column_values":[{"text":"Caracas, Distrito Capital, Venezuela"}]},{"id":"Edith Ruza","column_values":[{"text":"Buenos Aires, CABA, Argentina"}]},{"id":"david Rios","column_values":[{"text":"Perth Australia Occidental, Australia"}]},{"id":"Peter Doe","column_values":[{"text":"Calgary, Alberta, Canadá"}]},{"id":"Mary Jones","column_values":[{"text":"London, Reino Unido"}]},{"id":"Lionel Messi","column_values":[{"text":"París, Francia"}]},{"id":"Samy Forte","column_values":[{"text":"Mexico City, CDMX, México"}]},{"id":"Tadeo Carthy","column_values":[{"text":"Tel Aviv, Israel"}]}]}]}
and this is my code that not work:
class App extends React.Component {
constructor(props) {
super(props);
// Default state
this.state = {
setData:{},
settings: {},
myData: {},
};
}
com
componentDidMount() {
monday
.api('query { boards( ids : 2664704591 ) { items { id : name column_values(ids : "ubicaci_n") { text }}}}')
.then(res => {this.setState({myData: res.data})});
}
render() {
return (
<div className="App">
<AttentionBox
title="hola"
text="Let's start building your amazing app, which will change the world!"
/>
<div className="btn btn-primary"></div>
<button className="btn btn-warning"></button>
<div>
{this.state.myData.map((property) => {
return (<div>property</div>)
})}
</div>
</div>
);
}
}
export default App;
I would greatly appreciate any clue to move forward