简体   繁体   English

提供的React Redux无效道具

[英]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.

相关问题 React-Redux错误提供给提供者的对象类型为对象的无效子属性prop - React-Redux error Invalid prop `children` of type `object` supplied to `Provider` 提供给图像 React Native 的无效道具源 - invalid prop source supplied to image React Native 反应错误:提供给 React.Fragment 的道具“类”无效 - React error : Invalid prop `class` supplied to React.Fragment 警告:道具类型失败:提供给“路由”的道具“组件”无效:道具不是路由中的有效 React 组件 - Warning: Failed prop type: Invalid prop 'component' supplied to 'Route': the prop is not a valid React component in Route 为什么图像不显示在 React Native 中? 失败的道具类型:提供给`Image` 的道具`source` 无效 - Why aren't images showing in React Native? Failed prop type: Invalid prop `source` supplied to `Image` 警告:道具类型失败:提供给“图像”的道具“来源”无效。 在本机反应 - warning: Failed prop type: Invalid prop `source` supplied to `Image`. in react native React Native错误失败的道具类型:提供给`Overlay`的`array`类型的无效道具`children`, - React Native error Failed prop type: Invalid prop `children` of type `array` supplied to `Overlay`, 道具类型失败:提供给“TextInput”React Native 的“对象”类型的无效道具“值” - Failed prop type: Invalid prop 'value' of type 'object' supplied to 'TextInput' React Native 警告:失败的道具类型:提供给“路由”的无效道具“组件”-react-router-dom - Warning: Failed prop type: Invalid prop 'component' supplied to 'Route' - react-router-dom (Material-ui / React)道具类型失败:提供给GridList的道具“ cellHeight”无效 - (Material-ui / React) Failed prop type: Invalid prop `cellHeight` supplied to `GridList`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM