1

While adding the react-flowbite modal to a react code, this error appears:

onClick is not defined

How to configure all that? How to setup a button so that it toggles the modal onClick? Thanks

These are the imports :

import {
  Button,
  Checkbox,
  Label,
  Modal,
  TextInput,
} from "flowbite-react";

This is the code: (Couldn't paste it here because the code was more that text) https://flowbite-react.com/modal

Scroll down up to "form elements"

Zen
  • 53
  • 1
  • 7

1 Answers1

0

use imported Modal as wrapper for your Modal component

import { Modal } from "flowbite-react";
function App() {
const [show, setShow] = useState(false)
return (
<button onClick={() => setShow(true)}>toggle modal</button>
<Modal show={show} handleClose={() => setShow(false)}>
<div>Modal Content</div>
</Modal>
)
}