简体   繁体   English

如何实现 React-Bootstrap?

[英]How to implement React-Bootstrap?

I'm trying to implement React-Bootstrap to my application and somehow it does not render.我正在尝试对我的应用程序实施 React-Bootstrap,但它无法以某种方式呈现。

This is the code that I have tried:这是我试过的代码:

import React from 'react';

import { CardGroup, Card, Button, Container, CardImg, ListGroup, ListGroupItem, Row, Col } from 'react-bootstrap';

export class MovieView extends React.Component {
  render() {
    const { movie, onBackClick } = this.props;
    return (
      <Container>
        <Row>
          <Col>
            <CardGroup>
              <Card>
                <CardImg className="movie-view movie-poster" src={movie.ImagePath} />
                <Card.Body>
                  <Card.Title className="movie-title value">{movie.Title}</Card.Title>
                  <Card.Text className="movie-description value">{movie.Description}</Card.Text>
                </Card.Body>
                <Card.Body>
                  <ListGroup>
                    <ListGroupItem className="movie-genre">{movie.Genre.Name}</ListGroupItem>
                    <ListGroupItem className="movie-director">{movie.Director.Name}</ListGroupItem>
                  </ListGroup>
                  <Button variant="Primary" onClick={() => { onBackClick(null); }}>
                    Back
                  </Button>
                </Card.Body>
              </Card>
            </CardGroup>
          </Col>
        </Row>
      </Container>
    );
  }
}

If not, try adding this line in your src/index.js or App.js file如果没有,请尝试在您的 src/index.js 或 App.js 文件中添加这一行

import 'bootstrap/dist/css/bootstrap.min.css';

See this documentation请参阅 此文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM