Javascript 未捕获的TypeError:(0,a.getFirestore)不是函数

Javascript 未捕获的TypeError:(0,a.getFirestore)不是函数,javascript,firebase,react-redux,redux-firestore,Javascript,Firebase,React Redux,Redux Firestore,在我正在开发的一个博客web应用程序中,当我试图提交一个提问表单时,我收到了上述错误。我将问题表单建立在写博客帖子的表单上,提交时不会导致任何错误。我想知道为什么我在问题表单上收到错误,而不是博客帖子表单。我将在下面发布组件、操作和减速器的代码 CreateQuestion.js import React, { Component } from 'react'; import { connect } from 'react-redux'; import { createQuestion } fr

在我正在开发的一个博客web应用程序中,当我试图提交一个提问表单时,我收到了上述错误。我将问题表单建立在写博客帖子的表单上,提交时不会导致任何错误。我想知道为什么我在问题表单上收到错误,而不是博客帖子表单。我将在下面发布组件、操作和减速器的代码

CreateQuestion.js

import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createQuestion } from '../../store/actions/questionActions';

class CreateQuestion extends Component {
  state={
    ask: ''
  }
  handleChange = (e) => {
    this.setState({
      [e.target.id]: e.target.value
    });
  }
  handleSubmit = (e) => {
    e.preventDefault();
    this.props.createQuestion(this.state);
    this.props.history.push('/');
  }
  render() {

    return (
      <div className="container">
        <form onSubmit={this.handleSubmit} className="white">
          <h5 className="grey-text text-darken-3">Ask a Question</h5>
          <div className="input-field">
            <label htmlFor="ask">Type your question here:</label>
            <input type="text" id="ask" onChange={this.handleChange}/>
          </div>
          <div className="input-field">
            <button className="btn pink lighten-1 z-depth-0">Submit</button>
          </div>
        </form>
      </div>
    );
  }
}

const mapStateToProps = (state) => {
  console.log(state);
  return {
    auth: state.firebase.auth
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    createQuestion: (question) => dispatch(createQuestion(question))
  }
};

export default connect(mapStateToProps, mapDispatchToProps)(CreateQuestion);
postActions.js

export const createQuestion = question => (dispatch, { getFirestore }) => {
  const fireStore = getFirestore();

  fireStore.collection('questions').add({
    ...question,
    createdAt: new Date(),
  }).then(() => dispatch({
    type: 'CREATE_QUESTION',
    question,
  })).catch(err => dispatch({
    type: 'CREATE_QUESTION_ERROR',
    err,
  }));
};
export const createPost = post => (dispatch, getState, { getFirestore }) => {
  const fireStore = getFirestore();
  const profile = getState().firebase.profile;
  const authorId = getState().firebase.auth.uid;

  fireStore.collection('posts').add({
    ...post,
    authorFirstName: profile.firstName,
    authorLastName: profile.lastName,
    authorId: authorId,
    createdAt: new Date(),
  }).then(() => dispatch({
    type: 'CREATE_POST',
    post,
  })).catch(err => dispatch({
    type: 'CREATE_POST_ERROR',
    err,
  }));
};
Problem.js

const initState = {
  questions: [
    {id: '1', ask: 'What is your name?'},
    {id: '2', ask: 'What is your quest?'},
    {id: '3', ask: 'What is your favorite color?'}
  ]
};

const questionReducer = (state = initState, action) => {
  switch (action.type) {
    case 'CREATE_QUESTION':
      console.log('created question', action.question)
      return state;
    case 'CREATE_QUESTION_ERROR':
      console.log('create question error', action.err);
      return state;
    default:
      return state;
  }
};

export default questionReducer;
const initState = {
  posts: [
    {id: '1', title: 'help me find peach', content: 'blah blah blah'},
    {id: '2', title: 'collect all the stars', content: 'blah blah blah'},
    {id: '3', title: 'egg hunt with yoshi', content: 'blah blah blah'}
  ]
};

const postReducer = (state = initState, action) => {
  switch (action.type) {
    case 'CREATE_POST':
      console.log('created post', action.post)
      return state;
    case 'CREATE_POST_ERROR':
      console.log('create post error', action.err);
      return state;
    default:
      return state;
  }
};

export default postReducer;
postReducer.js

const initState = {
  questions: [
    {id: '1', ask: 'What is your name?'},
    {id: '2', ask: 'What is your quest?'},
    {id: '3', ask: 'What is your favorite color?'}
  ]
};

const questionReducer = (state = initState, action) => {
  switch (action.type) {
    case 'CREATE_QUESTION':
      console.log('created question', action.question)
      return state;
    case 'CREATE_QUESTION_ERROR':
      console.log('create question error', action.err);
      return state;
    default:
      return state;
  }
};

export default questionReducer;
const initState = {
  posts: [
    {id: '1', title: 'help me find peach', content: 'blah blah blah'},
    {id: '2', title: 'collect all the stars', content: 'blah blah blah'},
    {id: '3', title: 'egg hunt with yoshi', content: 'blah blah blah'}
  ]
};

const postReducer = (state = initState, action) => {
  switch (action.type) {
    case 'CREATE_POST':
      console.log('created post', action.post)
      return state;
    case 'CREATE_POST_ERROR':
      console.log('create post error', action.err);
      return state;
    default:
      return state;
  }
};

export default postReducer;