Injecting Dependencies In Vs Package.json
I have bootstrap dependency inside the "head" tag of html file which references physically added library files that i downloaded.
I also have a bootstrap dependency inside package.json added via npm.
I only need the dependencies in one place right? For example i can remove from "head" tag and keep inside package.json?
Answer
Adding dependencies inside your package.json
does not means that dependencies are automatically used by your bundle: you have to import stuff inside your JS/SASS
to make this happen.
You didn't said what is you bootstrap dependency, but let say is the default Bootstrap package. You have to do:
import "bootstrap/dist/css/bootstrap.css"
To have the Bootstrap CSS bundled in your application. The same for the JavaScript source... but I don't think you really want to have Bootstrap JS in a React app. Look at react-bootstrap instead.
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?