一直在努力并遵循这里创建的完整项目:https://www.youtube.com/watch?v=a9MZOrFoPTY&list=PLMhAeHCz8S38ryyeMiBPPUnFAiWnoPvWP&index=34
前端存储库(如果您想分叉,以指导您解决我的错误): https://github.com/hidjou/classsed-react-firebase-client
首先,我尝试过寻求作者的帮助,但一直没有得到任何答复,这就是为什么我在这里寻求帮助。总而言之,这是Twitter的社交媒体衍生产品。
我的问题:我正在尝试在登录/注册时加载用户信息,但是正在发生一些事情: -我出现渲染错误 -属性未正确传递;即使在我的“ propTypes”中将其标记为必需,登录信息也是“未定义”
首先,自从“个人资料栏目”视频以来,我一直不断遇到此Type错误:
Uncaught TypeError: Cannot read property 'handle' of undefined
- at Scream.render (Scream.js:41)
at finishClassComponent (react-dom.development.js:15319)
at updateClassComponent (react-dom.development.js:15274)
at beginWork (react-dom.development.js:16262)
at performUnitOfWork (react-dom.development.js:20279)
at workLoop (react-dom.development.js:20320)
尝试修复第一个错误时出现了第二个错误。我尝试解决第一个错误的方法是通过传播状态而不是userReducer.js的SET_USER情况下的action.payload。而是导致此错误:
- Warning: Failed prop type: The prop `user` is marked as required in `LikeButton`, but its value is `undefined`in LikeButton (at ScreamDialog.js:223)
in ScreamDialog (created by WithStyles(ScreamDialog))
in WithStyles(ScreamDialog) (created by ConnectFunction)
in ConnectFunction (at Scream.js:77)
我仔细检查了我代码中的调用执行情况(与您的代码完全相同),我相信这仍然是由于未在整个系统中正确传递属性而导致的。虽然,我不确定tbh。