react-bootstrap example
Bootstrap and React-Bootstrap Example
To use the React-Bootstrap library, you can start by installing it using npm:
npm install react-bootstrap bootstrap
After installing the library, you can import and use components from React-Bootstrap in your React components as follows:
import React from 'react';
import { Button } from 'react-bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
function ExampleComponent() {
return (
<Button variant="primary">Click me</Button>
);
}
export default ExampleComponent;
In this example, we import the Button
component from react-bootstrap
and use it within the ExampleComponent
function. Additionally, we import the Bootstrap CSS to ensure the styles are applied correctly.
This is a basic example of using React-Bootstrap components in a React application.