【发布时间】:2019-06-23 20:11:08
【问题描述】:
我不知道如何将“profile”或“auth”道具传递给 firestoreConnect() 函数,以便根据用户 ID 或其他键查询集合或文档(我的代码 sn-p 在下面)。
我可以在我的 jsx 代码中访问 'auth' 和 'profile' 对象,但我找不到在 firestoreConnect() 函数中使用它们的方法(我收到一个错误:TypeError: Cannot read property 'uid' of undefined)。如果我对一些 uid 进行硬编码,那么一切正常,但我不能将其作为 props 值传递。
任何建议都非常感谢!
export default compose(
firebaseConnect(),
firestoreConnect(props => [{ collection: 'projects', where: [['uid', '==', props.auth.uid]] }]), <<--THIS LINE DOES NOT WORK
connect((state, props) => ({
projects: state.firestore.ordered.projects,
profile: state.firebase.profile,
auth: state.firebase.auth,
}))
)(Projects);
【问题讨论】:
标签: reactjs firebase react-redux-firebase