1

Im trying to use Accordion in Bootstrap React but Visual Studio Code is complaining that it cant find it.

enter image description here

As the docs states I only needed to include a import of Accordion?

What I imported: import { Col, Row, Container, Form, Accordion } from "react-bootstrap";

How can I fix this? It's not possible to import Accordion.Header for instance.

1 Answer 1

1

You can try using them as classes?

example: class="accordion-header". Give it a try.

Didn't found anything on their docs.

Or

something like this: import { Col, Row, Container, Form, Accordion: { Body, Header} } from "react-bootstrap";

Sorry for making it as an anwser, i can't make comments yet

Sign up to request clarification or add additional context in comments.

2 Comments

That might work, but again the compiler is complaining about the div tag for the Item, is there a way I can put eventKey in there somehow? eventKey="0" gives me the error: Property 'eventKey' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>'. I've tried your import string too but did not work
Doesn't it need a toogle? check this out pluralsight.com/guides/use-bootstrap-accordion-with-react

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.