In weather api, some values are null which is displayed as undefined on main page (See the image at the bottom), which takes maximum space. How to replace these null values with empty i.e ' ' or 'NA'?
Below is the code
fetch(`${IP_LOCATION}&lat=${lat}&long=${lon}`)
.then(res => res.json()).then(responseJson => {
try {
this.setState({
sunrise: responseJson.sunrise,
sunset: responseJson.sunset,
// Here I get undefined
moonrise: responseJson.moonrise,
moonset: responseJson.moonset,
})
} catch {
toast.error('No Data Received')
}
});
Any solution?
