Reputation: 9194
I'm curious about something I read in the react-bootstrap
documentation:
You should import individual components like:
react-bootstrap/Button
rather than the entire library. Doing so pulls in only the specific components that you use, which can significantly reduce the amount of code you end up sending to the client.
import Button from 'react-bootstrap/Button';
https://react-bootstrap.github.io/getting-started/introduction#importing
Sounds good. But a library like react-bootstrap
you could be importing different components. Would you have to add several import
in component or is there a more efficient way to specify this?
Upvotes: 1
Views: 80
Reputation: 1072
I'm pretty sure you would have to import each component individually, unless you import the full library.
import { Button, Alert } from 'react-bootstrap';
or
import Button from 'react-bootstrap/Button';
import Alert from 'react-bootstrap/Alert';
Upvotes: 5