title: Why is my navbar collapse toggle not working in react
body: <p>I wanted to create a responsive navbar. But the toggle does not work. What should I do?</p>
  
  <p>I added the bootstrap, jQuery and popper.js links as specified in the bootstrap documentation and created a navbar component. The navbar is styled like it should be when not collapsed, but after collapse the Toggle does not work. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
  
  import "jquery/dist/jquery"
  import "bootstrap/dist/js/bootstrap";
  import 'bootstrap/dist/css/bootstrap';
  
  class Navbar extends Component {
      render() {
          return (
              &lt;React.Fragment&gt;
                  
                  &lt;nav className="navbar navbar-expand-lg navbar-light bg-light"&gt;
                      &lt;a className="navbar-brand" href="/"&gt;Aditya Chopra&lt;/a&gt;
                      &lt;button className="navbar-toggler" type="button" data-toggle="collapse" data-target="/navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"&gt;
                          &lt;span className="navbar-toggler-icon"&gt;&lt;/span&gt;
                      &lt;/button&gt;
  
                      &lt;div className="collapse navbar-collapse" id="navbarSupportedContent"&gt;
                          &lt;ul className="navbar-nav mr-auto"&gt;
                              
                              &lt;li className="nav-item"&gt;
                                  &lt;a className="nav-link" href="/About"&gt;About&lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li className="nav-item"&gt;
                                  &lt;a className="nav-link" href="/Contact"&gt;Contact&lt;/a&gt;
                              &lt;/li&gt;
                              &lt;li className="nav-item active"&gt;
                                  &lt;a className="nav-link" href="/Projects"&gt;Projects &lt;/a&gt;
                              &lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/div&gt;
                  &lt;/nav&gt;
              &lt;/React.Fragment&gt; 
          );
      }
  }
  
  export default Navbar;</code></pre>
  </div>
  </div>
  </p>
  
  <p>index.html:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8" /&gt;
  
    &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
    &lt;meta name="theme-color" content="#000000" /&gt;
  
    &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"&gt;
    &lt;link rel="manifest" href="%PUBLIC_URL%/manifest.json" /&gt;
    &lt;link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"&gt;
    &lt;title&gt;Aditya Chopra&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;
    &lt;div id="root"&gt;&lt;/div&gt;
  
    &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"&gt;&lt;/script&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"&gt;&lt;/script&gt;
    &lt;script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When the viewport is small enough, I expected it to expand the navbar via the toggle button, but it does nothing.</p>