bootstrap collapse is not working in my react app .
i want the collapse functionality in my app it is not working in my reactapp.
i think bootstrap classes are working but bootstrap onclick is not working
codesandbox code codesandboxlink
bootstrap code bootstrap link solve this problem
Advertisement
Answer
you have to insall three dependencies in your app
- bootstrap
- jquery
- @popperjs/core
you have to keep all the script tags in the index.html page
JavaScript
x
24
24
1
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
2
3
<link
4
rel="stylesheet"
5
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
6
integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
7
crossorigin="anonymous"
8
/>
9
<script
10
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
11
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
12
crossorigin="anonymous"
13
></script>
14
<script
15
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"
16
integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4"
17
crossorigin="anonymous"
18
></script>
19
<script
20
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"
21
integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1"
22
crossorigin="anonymous"
23
></script
24