简体   繁体   中英

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

react-admin: 3.8.4

I have a simple show structure as below:


const OfferShow = (props) => {

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

export default OfferShow;

if I remove the tag <SimpleShowLayout> I don't see this error anymore, if I put the tag the error is:

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... 

Does anyone already got this error and could help me?

You can remove an unwanted prop such as hasShow and still use the spread operator like this:

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

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

      </SimpleShowLayout>
    </Show >
  )
}

export default OfferShow;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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