简体   繁体   中英

Modal Property 'show' does not exist on type 'IntrinsicAttributes'

I use the Modal component exactly as shown in the react-bootstrap docs but I get the error Property 'show' does not exist on type 'IntrinsicAttributes & [...]'

<Modal show={props.showModal} onHide={props.handleCloseModal}>
      <Modal.Header closeButton>
        <Modal.Title>Seleccionaste la opcion:</Modal.Title>
      </Modal.Header>
      <Modal.Body>
[...]

After digging in node_modules/react-bootstrap/esm/Modal.d.ts I found that effectively show doesn't exist on the type definitions for react-bootstrap@^1.3.0 (weird because is the latest version according to the official website and even the docs tell you to use that prop).

So my solution was to install @types/react-bootstrap where the show props was definitely included. That solved my problem!

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