繁体   English   中英

React 无法识别 DOM 元素上的 `hasShow` 属性

[英]React does not recognize the `hasShow` prop on a DOM element

反应管理员:3.8.4

我有一个简单的显示结构如下:


const OfferShow = (props) => {

  return (
    <Show component="div" title={<PageTitle text="Oferta" prop="title" />} {...props}>
      <SimpleShowLayout>
    
      </SimpleShowLayout>
    </Show >
  )
}

export default OfferShow;

如果我删除标签<SimpleShowLayout>我不会再看到这个错误,如果我把标签错误是:

index.js:1 Warning: React does not recognize the `hasShow` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `hasshow` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in div (created by ShowView)
    in ShowView (created by Show)
    in Show (at OfferShow.js:23)
    in OfferShow (created by WithPermissions)
    in WithPermissions (created by... 

有没有人已经得到这个错误并且可以帮助我?

您可以删除不需要的道具,例如hasShow并仍然使用扩展运算符,如下所示:

const OfferShow = ({ hasShow, ...rest }) => {

  return (
    <Show component="div" title={<PageTitle text="Oferta" prop="title" />} {...rest}>
      <SimpleShowLayout>

      </SimpleShowLayout>
    </Show >
  )
}

export default OfferShow;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM