Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BenjErgizerBunny/f4a839953b57ba8d8a94f7f2f08aa751 to your computer and use it in GitHub Desktop.
Save BenjErgizerBunny/f4a839953b57ba8d8a94f7f2f08aa751 to your computer and use it in GitHub Desktop.
toScreenTwo = async () => {
const { isLoggedIn, user} = this.state;
try {
if (!isLoggedIn) {
const response = await http.post('/v1/signup/user', {
user,
})
for (var value in response.data) {
await this.state.tableData2.push(value);
}
console.log('response', this.state.tableData2);
}
await this.setState({
modalVisible: false,
friendsModalVisible: false
});
} catch(err) {
console.log("error ", err);
}
}
@navneet-kumar
Copy link

navneet-kumar commented Feb 27, 2019

Just change your for loop to below :

for (var key in response.data) {
          await this.state.tableData2.push(response.data[key]);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment