Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
Reactstrap navbar toggle not toggling in NextJS TypeScript project

I've installed Reactstrap on a project using the NextJS TypeScript install. I've copied the Navbar example from the Reactstrap docs. The navigation shows fine, but on mobile when I click the Navbar toggle, the toggle menu does not open. In fact, no JavaScript components from Reactstrap worked. I've tried modals as well, they don't work either.

Aside from the JavaScript not working when using the Reactstrap components, the Reactstrap CSS styles work completely fine.

Link to live project codesandbox to test.

Code for the Navbar specifically below:

import Link from "next/link";
import {
  NavbarBrand,
  NavbarToggler,
  Collapse,
  NavItem,
  NavLink,
  Nav,
  Navbar,
} from "reactstrap";

import styles from "./Navigation.module.scss";

const Navigation = () => {
  return (
    <div className={styles.nav}>
      <Navbar expand="md">
        <NavbarBrand href="/">Premium Delivery</NavbarBrand>
        <NavbarToggler onClick={function noRefCheck() {}} />
        <Collapse navbar>
          <Nav className="ms-auto" navbar>
            <NavItem>
              <NavLink>
                <Link href="/">Home</Link>
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink>
                <Link href="/services">Services</Link>
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink>
                <Link href="/service-fees">Service Fees</Link>
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink>
                <Link href="/about">About</Link>
              </NavLink>
            </NavItem>
            <NavItem>
              <NavLink>
                <Link href="/contact">Contact</Link>
              </NavLink>
            </NavItem>
          </Nav>
        </Collapse>
      </Navbar>
    </div>
  );
};

export default Navigation;
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I don't know why, but their documentation on the Storybook puts the function noRefCheck() as a placeholder. You are meant to create your own function to activate the Reactstrap code as described in their Github examples: https://github.com/reactstrap/reactstrap/blob/master/stories/examples/NavbarToggler.js

First, import useState so we can use the hook. import { useState } from 'react';

Somewhere before the return, add a hook like const [isOpen, setIsOpen] = useState(false);

Next, for the NavbarToggle, add the hook to the Event <NavbarToggler onClick={() => { setIsOpen(!isOpen) }} />

Finally, ensure that the Collapse has the correct state

<Collapse isOpen={isOpen} navbar>
Navbar Contents
</Collapse>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda