React-bootstrap: [Docs] Show `import` statements for component examples

Created on 29 Sep 2017  路  3Comments  路  Source: react-bootstrap/react-bootstrap

As a person jumps in to start using this library, it would be helpful to see the syntax for bringing the "react-boostrap" components into his/her project.

For instance, when I am wanting to use a <Panel> and <ListGroup> in my project, I would love to look up exactly how it should be brought into the file.

import React, { Component } from 'react';
import {
  ListGroup,
  Panel,
} from 'react-bootstrap';

As a person who first used this project about a month ago, it threw me for a loop to not see the import statements. 馃

If this is amenable to our wonderful benefactors, then I would be happy to take up the torch and implement this in the project.

enhancement

Most helpful comment

@taion I understand that not everyone is using webpack, but it definitely seems like the "Way of the Future". 馃榾 The project over at Material-UI uses the import in examples.

What is the recommended method of importing components for react-bootstrap?

I see in the linked issue above that we can edit the examples directly in the browser. I have used these docs for about 3 months now...had no idea! Let's tell people!

All 3 comments

Sort of a dupe of https://github.com/react-bootstrap/react-bootstrap/issues/2573

Part of the problem is that we don't actually recommend importing things like that

@taion I understand that not everyone is using webpack, but it definitely seems like the "Way of the Future". 馃榾 The project over at Material-UI uses the import in examples.

What is the recommended method of importing components for react-bootstrap?

I see in the linked issue above that we can edit the examples directly in the browser. I have used these docs for about 3 months now...had no idea! Let's tell people!

Should be enough: https://react-bootstrap.netlify.com/getting-started/introduction/#importing

If not, feel free to file up a PR.

Was this page helpful?
0 / 5 - 0 ratings