-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Generalize the adding bootstrap documentation #5631
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,36 +3,28 @@ id: adding-bootstrap | |
| title: Adding Bootstrap | ||
| --- | ||
|
|
||
| You don’t have to use [reactstrap](https://reactstrap.github.io/) together with React but it is a popular library for integrating Bootstrap with React apps. If you need it, you can integrate it with Create React App by following these steps: | ||
| While you don’t have to use any specific library to integrate Bootstrap with React apps, it's often easier than trying to wrap the Bootstrap jQuery plugins. [React Bootstrap](https://react-bootstrap.netlify.com/) is the most popular option, that strives for complete parity with bootstrap. [reactstrap](https://reactstrap.github.io/) is also a good choice for projects looking for smaller builds at the expense of less features. | ||
|
|
||
| Install reactstrap and Bootstrap from npm. reactstrap does not include Bootstrap CSS so this needs to be installed as well: | ||
| Each projects respective documentation site has detailed instructions for installing and using them. Both depend on the Bootstrap css file so install that as well: | ||
|
|
||
| ```sh | ||
| npm install --save reactstrap bootstrap@4 | ||
| npm install --save bootstrap | ||
| ``` | ||
|
|
||
| Alternatively you may use `yarn`: | ||
|
|
||
| ```sh | ||
| yarn add bootstrap@4 reactstrap | ||
| yarn add bootstrap | ||
| ``` | ||
|
|
||
| Import Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your `src/index.js` file: | ||
|
|
||
| ```js | ||
| import 'bootstrap/dist/css/bootstrap.css'; | ||
| import 'bootstrap/dist/css/bootstrap.css' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our default template uses semicolons. |
||
| // Put any other imports below so that CSS from your | ||
| // components takes precedence over default styles. | ||
| ``` | ||
|
|
||
| Import required reactstrap components within `src/App.js` file or your custom component files: | ||
|
|
||
| ```js | ||
| import { Button } from 'reactstrap'; | ||
| ``` | ||
|
|
||
| Now you are ready to use the imported reactstrap components within your component hierarchy defined in the render method. Here is an example [`App.js`](https://gist.githubusercontent.com/zx6658/d9f128cd57ca69e583ea2b5fea074238/raw/a56701c142d0c622eb6c20a457fbc01d708cb485/App.js) redone using reactstrap. | ||
|
|
||
| ## Using a Custom Theme | ||
|
|
||
| > Note: this feature is available with `react-scripts@2.0.0` and higher. | ||
|
|
@@ -55,5 +47,5 @@ $body-bg: #000; | |
| Finally, import the newly created `.scss` file instead of the default Bootstrap `.css` in the beginning of your `src/index.js` file, for example: | ||
|
|
||
| ```javascript | ||
| import './custom.scss'; | ||
| import './custom.scss' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add semicolon back. |
||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The end of this sentence doesn't sound right.
expense of less featuessounds kind of like a double negative. Maybe something likeat the expense of some features?