[英]React Redux Invalid Prop supplied
My current flow of data is like this, 我目前的数据流是这样的,
BookContainer (Passes in props needed by book form, eg drop down selection options)
|_ BookModal (Handles the form submission)
|_ CreateBookForm (Contains form tag and input fields, Dumb Component)
The problem I'm facing is when my BookModal handles the form submission, everything goes through nicely however I get this error this.props.books.map is not a function
. 我面临的问题是当我的BookModal处理表单提交时,一切都顺利进行,但是我遇到了这个错误
this.props.books.map is not a function
。 The books prop is passed in from the BookContainer -> BookModal -> CreateBookForm
to populate the books I have to choose from. 书籍道具从
BookContainer -> BookModal -> CreateBookForm
传入,以填充我必须选择的书籍。 The return response from BookModal
after the form submission from CreateBookForm
is a Promise of whether the request is successful or failed. 从
CreateBookForm
提交BookModal
后, BookModal
的返回响应是对请求成功还是失败的承诺。
I am not sure if my current flow of passing data is correct, but so far all the data displays correctly. 我不确定我当前的传递数据流是否正确,但是到目前为止,所有数据都可以正确显示。 It is only after when I submit the form I'll get this error.
只有当我提交表格后,我才会收到此错误。 I am using https://github.com/erikras/react-redux-universal-hot-example as my boilerplate.
我正在使用https://github.com/erikras/react-redux-universal-hot-example作为样板。 Any suggestions, or ideas is appreciated!
任何建议或想法表示赞赏! Thanks.
谢谢。
Basically, the mistake is just a state used by 2 different properties. 基本上,错误只是2个不同属性使用的状态。 Hence causing the different property types.
因此导致不同的属性类型。 All I had to do was modify my action creator and not mix up the states.
我要做的就是修改动作创建者,而不是混淆状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.