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

Hi Thanh Tùng #1

Open
namthang opened this issue Apr 27, 2016 · 2 comments
Open

Hi Thanh Tùng #1

namthang opened this issue Apr 27, 2016 · 2 comments

Comments

@namthang
Copy link

namthang commented Apr 27, 2016

Hi Thanh Tùng, bạn có thể thêm react bootstrap vào project được không? Cảm ơn nhiều

@thanhtungdp
Copy link
Owner

Cái này thì dễ ấy mà.
Gõ lệnh npm install --save react-bootstrap
Như vậy là đã cài được thư viện của nó rồi.
Note: React boostrap thật ra nó chỉ viết lại các component, bằng cách chèn thêm các className vào, chứ mặc định nó không có require CSS.

Cách 1: chèn file CSS vào index.html, bạn có thể dùng cdn của bootstrap.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>

Cách 2 chèn trực tiếp bootstrap sass vào file bundle.js

Với cách này thì bạn sẽ cài đặt bootstrap-sass từ npm
npm install --save bootstrap-sass
Sau đó bạn mở file app/App.js chèn sass vào

import 'bootstrap-sass/assets/stylesheets/_bootstrap.scss'

Lúc này thì css sẽ được nén vào file bundle.js
Note: Để biên dịch được sass, thì bạn cần phải cài đặt plugin sass cho webpack, ở trong bộ starter này thì mình đã cài đặt rùi 👯

Example code

import React from 'react';
import {Grid, Col, FormControl} from 'react-bootstrap';
export default class TestPage extends React.Component{
     render(){
           <Grid>
                <Col md={6} mdOffset={3}>
                  <FormControl placeholder="Test..."/>
                </Col>
           </Grid>
      }
}

@thanhtungdp
Copy link
Owner

@namthang đã update react bootstrap
Example: app/containers/SearchApp.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants