I am using async/await with React Native.
My result from response.json() : {_45: 0, _81: 0, _65: null, _54: null}
For some reason, the actual answer I want is in _65, and I don't know what these random keys are.
This seems to be due to the .json() returning Promise.
componentDidMount() { this.getData().then(data => this.setState({ data })) } async getData() { try { let response = await fetch(myUrl) let json = await response.json() return json } catch(err) { Alert.alert(null, err) } } render() { const { data } = this.state ...
source share