Answer the question
In order to leave comments, you need to log in
Why is Static backdrop from React Bootstrap not working?
The button itself appears on the site, but for some reason it is not active.
here is the code
import React, { useState } from "react";
import {Button} from 'react-bootstrap'
import Modal from 'react-modal';
const Hack = () => {
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
return (
<>
<Button variant="primary" onClick={handleShow}>
ЖМЯК
</Button>
<Modal
show={show}
onHide={handleClose}
backdrop="static"
keyboard={false}
>
<Modal.Header closeButton>
<Modal.Title>Modal title</Modal.Title>
</Modal.Header>
<Modal.Body>
I will not close if you click outside me. Don't even try to press
escape key.
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose}>
Close
</Button>
<Button variant="primary">Understood</Button>
</Modal.Footer>
</Modal>
</>
);
}
export default Hack;
Answer the question
In order to leave comments, you need to log in
not a correct Modal import, it should beimport Modal from 'react-bootstrap/Modal'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question