Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

121
Visualizações
Close Bootstrap modal using jQuery in React application

I am trying to use Bootstrap modal inside React. I have successfully opened a modal. For closing the modal programatically, I am using the below code.

$('#exampleModal').modal('hide')

The code is written inside the onClick event of a button. When I click the button, I am getting the error Unhandled Rejection (TypeError): jquery__WEBPACK_IMPORTED_MODULE_6___default(...)(...).modal is not a function

I have imported Bootstrap and jQuery as below.

import 'bootstrap';
import $ from 'jquery'; 

How to fix this? How can I use jQuery inside React to close the modal?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use react-bootstrap and try to avoid JQuery while working with React. Because JQuery is at a bit different level than React internals, if I can put it this way.

In this example you can see how it can be handled within component state to show modal: https://react-bootstrap.github.io/components/modal/#modals-live

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda