问题
i want to fetch all data from firestore and show on a list
export const fetchAds = () => {
return dispatch => {
firebase
  .firestore()
  .collection("ads")
  .get()
  .then(ads => {
    dispatch({ type: FETCH_ADS, ads });
  });
 };
};
this is my actions file
import * as actions from "../../actions"; 
class HomeScreen extends Component {
 renderAds() {
return this.props.ads.map((ad, index) => {
  return <Cards key={index} ad={ad} />;
 });
}
  function mapStateToProps(state) {
   return {
     ads: state.ads.data
  };
  }
export default connect(
   mapStateToProps
   )(HomeScreen);
this is my list where i can show it but it show me the error undefined is not an object (evaluating ' _firebase.firebase.firestore
回答1:
you should have to firestore from firebase package!
like:
import firebase from 'firebase'
import 'firebase/firestore';
export const fetchAds = () => {
return dispatch => {
firebase
  .firestore()
  .collection("ads")
  .get()
  .then(ads => {
    dispatch({ type: FETCH_ADS, ads });
  });
 };
};
来源:https://stackoverflow.com/questions/55808613/undefined-is-not-an-object-evaluating-firebase-firebase-firestore