我不知道如何将 'profile' 或 'auth' props 传递给 firestoreConnect() 函数,以便根据用户 ID 或其他一些键查询集合或文档(我的代码片段如下)。
我可以在我的 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);
Run Code Online (Sandbox Code Playgroud)