Trying to render Footer component using inline if-else to avoid passing undefined data from Firebase, somehow it is passing those props, and Footer component yelling about undefined props.
this.state = {
location: {},
hours: {}
};
componentDidMount() {
db.collection('location').get().then(snapshot => {
snapshot.docs.forEach(doc => {
this.setState({
location: { ...doc.data()
}
})
})
});
db.collection('hours').get().then(snapshot => {
snapshot.docs.forEach(doc => {
this.setState({
hours: { ...doc.data()
}
})
})
});
}
render({
{
(this.state.hours) ? < Footer hours = {
this.state.hours
}
location = {
this.state.location
}
/> : null }
})