I have low internet so my code is'not working.
When I try to fetch data from local server, it comes to me if I have good connection, but if it is a weak connection I got some error on web page.
TypeError: Cannot read property 'map' of undefined
I want to write list of some music's which I have in DB with map function but i got this error.
so I want to provide this kind of error more beautifully not like this one for users, maybe it is some package or somthing thats helps me give me some advice.
mussic list display function
displayMussics() {
var data = this.props.data;
if(data.loading){
return (
<Dimmer active inverted>
<Loader inverted content='Loading' />
</Dimmer>
)
} else {
return data.mussics.map(mussic => {
return (
<li key={ mussic.id }>{ mussic.name }</li>
);
})
}
}