Trying to show the length of the data that is received from api response.but it say cannot read property of undefined
async componentDidMount() {
Users.getAppAuthUser(1,true).then((res)=>{
this.setState({data:res});
this.setState({loading:false});
})
console.log(this.state.data);
}
render() {
return (
<div >
<span >({ this.state.data ===[] ? 0 : this.state.data.accounts.length })
</span>
</div>
)
}
this.state.dataexists.