Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offcanvas example code not working #2755

Open
bloggrammer opened this issue Jun 5, 2023 · 1 comment
Open

Offcanvas example code not working #2755

bloggrammer opened this issue Jun 5, 2023 · 1 comment

Comments

@bloggrammer
Copy link

  • components: Offcanvas
  • reactstrap version #9.1.10
  • import method es
  • react version #18.2.0
  • bootstrap version #5.3.0

What is happening?

The example code for Offcanvas at https://reactstrap.github.io/?path=/docs/components-offcanvas--offcanvas is not working

What should be happening?

Update the example code

Steps to reproduce issue

  1. Visit the link: https://reactstrap.github.io/?path=/docs/components-offcanvas--offcanvas

Error message in console

No error message

Code

<div>
  <Button
    color="primary"
    onClick={function noRefCheck(){}}
  >
    Open
  </Button>
  <Offcanvas toggle={function noRefCheck(){}}>
    <OffcanvasHeader toggle={function noRefCheck(){}}>
      Offcanvas
    </OffcanvasHeader>
    <OffcanvasBody>
      <strong>
        This is the Offcanvas body.
      </strong>
    </OffcanvasBody>
  </Offcanvas>
</div>
@T3rm1
Copy link

T3rm1 commented Apr 12, 2024

You have to set isOpen of <Offcanvas>.

const [isOpen, setIsOpen] = useState(false)
const toggle = () => setIsOpen(!isOpen)

<Offcanvas toggle={toggle} isOpen={isOpen}>
    <OffcanvasHeader toggle={toggle}>
        ...
    </OffcanvasHeader>
    <OffcanvasBody>
        ...
    </OffcanvasBody>
</Offcanvas>

The documentation of this project is really bad and the library is full of bugs. I think the project is dead. I'd recommend looking for another library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants