reactjs – Synchronism problem with React, componentDidMount


I create a page with a graphic library. Some of these graphics are loaded into ComponentDidMount and when asked, axios, tb in the componentdidmount is executed later and does not paint the chart data, ie:

    constructor (accessories) {
super (accessories);
this.state = {
data: []
    }
}

componentDidMount () {
axios.get (& # 39; http: peticionapi & # 39;)
.then (answer => {
this.setState ({data: response.data})
console.log (this.state.datos)
console.log (& # 39; hello & # 39;)
})
console.log (& # 39; Goodbye & # 39;)
// the graph is mounted
}

I understand that when running before Goodbye, Hola is the problem for which I do not load the data ….