Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap animations not working #1392

Closed
gordillo99 opened this issue Jan 13, 2017 · 6 comments
Closed

Bootstrap animations not working #1392

gordillo99 opened this issue Jan 13, 2017 · 6 comments

Comments

@gordillo99
Copy link

Hey guys I am having problems with Bootstrap. So I have imported the bootstrap css files

import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap/dist/css/bootstrap-theme.css';

Bootstrap seems to be working fine, but the dropdown animation is not working. So, I assumed that it was because I was because it was missing the bootstrap.js file. So, I imported it

import 'bootstrap/dist/js/bootstrap.js'

However, when I do that, I get the following error:

Uncaught Error: Bootstrap's JavaScript requires jQuery

I have installed jQuery using npm, but I still see the error. How do I fix it?

PS: I'm really new to web development. Thanks for your help!

@raerpo
Copy link
Contributor

raerpo commented Jan 15, 2017

Hi Gordillo99,

You can't use jQuery's bootstrap features in a React project just like that because it tries to modify the DOM and React already does that. If you want to use bootstrap in a React project you have to use project that mix them to work nicely.

Maybe this?: https://github.com/reactstrap/reactstrap#adding-bootstrap

@Timer
Copy link
Contributor

Timer commented Jan 19, 2017

Hi @gordillo99!

Like @raerpo said, it is advised against using bootstrap directly as it modifies the DOM -- React should control these things.
I would suggest you look at react-bootstrap.

If you would like to use native bootstrap, however, you need to install jQuery yourself.
You can either add the script tag to your index.html, or npm install [email protected] --save (or yarn add [email protected]) and add import $ from 'jquery' or const $ = require('jquery') to the top of your index.js.

Let us know if you have any more questions!

@Timer Timer closed this as completed Jan 19, 2017
@cr101
Copy link
Contributor

cr101 commented Jan 19, 2017

@Timer react-bootstrap only supports Bootstrap 3 which is No Longer Supported while reactstrap uses Bootstrap 4

The current issue with using Bootstrap in a React app built with CRA is that you are not able to customize Bootstrap by changing the SASS variables because CRA does not process SASS files.

@Timer
Copy link
Contributor

Timer commented Jan 19, 2017

@olivia101 react-bootstrap supports the latest stable version of bootstrap, which is not going anywhere like v2.

As bootstrap 4 is not yet stable, we cannot recommend it to our users with confidence.


Additionally, you can support SASS customization without ejecting from CRA by adding a buildstep and adjusting start/build by appending node-sass ./src/scss/app.scss -w -o ./src/css && ....

@cr101
Copy link
Contributor

cr101 commented Jan 20, 2017

@Timer is adding support for SASS processing without ejecting documented because I couldn't find it in the CRA docs?

@Timer
Copy link
Contributor

Timer commented Jan 20, 2017

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants