【发布时间】:2020-11-13 21:56:43
【问题描述】:
我对 react firebase/firestore 有这个问题
错误:
未捕获的类型错误:无法解构“未定义”的属性“getFirestore”,因为它是未定义的
export const createTask = (task) => {
return(dispatch, getState, {getFirestore}) => {
const firestore = getFirestore();
firestore.collection('task').add({
...task,
author: 'Steven',
authorId: 1223,
createdAt: new Date()
}).then(() => {
dispatch({type: CREATE_TASK, task })
}).catch((err)=>{
dispatch({type: CREATE_TASK_ERROR, err})
})
}
}
有人知道要找什么吗?
【问题讨论】:
-
const firestore = getFirestore;