Create-react-app: How to use Bootstrap 4 alpha with create react app

Created on 23 Jun 2017  路  4Comments  路  Source: facebook/create-react-app

Bootstrap 4 alpha has a starter template that uses tether.js, jquery and the bootstrap CSS and JS.

How do I import and setup Bootstrap CSS, JS and the other dependencies?

I have tried various methods (downloading the js files, storing them in /src/js and /src/css) but keep getting errors such as: 'tether not defined, jquery not defined no-undef, etc'

Most helpful comment

*import this into you index.js file
import 'bootstrap/dist/css/bootstrap.css';

document in here http://reactstrap.github.io/

All 4 comments

You should use reactstrap. Otherwise, you need to import jquery and the bootstrap CSS.

Can you please share what you've tried?

I had the bootstrap 4 files(tether, jquery, css, js) in 'src/js' and 'src/css' folders and imported them in Index.js

I had a look at reactstrap earlier but was hoping to do this using basic imports.
I seem to have sorted out my issue using reactstrap though. Thanks!

*import this into you index.js file
import 'bootstrap/dist/css/bootstrap.css';

document in here http://reactstrap.github.io/

I used the approach @dbphanna posted (also in reactstrap installation instructions), it works fine in development, but on production but I get the error:

Module not found: Error: Can't resolve 'bootstrap/dist/css/bootstrap.css'

Was this page helpful?
0 / 5 - 0 ratings