In my componentDidMount() I am making an API call to fetch some data, this call then sets a state object that I use in my render.
componentDidMount()
componentDidMo
Using setState in componentdidmount. This my code:
async componentDidMount() { danhSachMon = await this.getDanhSachMon(); danhSachMon=JSON.parse(danhSachMon); this.setState(danhSachMon); } render() { return ( {item.title} } keyExtractor={(item, index) => index.toString()} /> ) }