Lets start by adding the dependency to your project:
npm install --save react-bootstrap-tabular # for classic npm
yarn add react-bootstrap-tabular # for the yarn users
Now that we have that settled we need to import and use the components. Let's provide a small example:
import React from 'react';
import { BootstrapDataTable, BootstrapDataColumn } from 'react-bootstrap-tabular';
export default class TestComponent extends React.Component {
render () {
const data = [
{ name: 'George', country: 'Greece' },
{ name: 'John', country: 'Italy' },
{ name: 'Mary', country: 'China' }
];
return (
<BootstrapDataTable data={data}>
<BoostrapDataColumn property='name' label='Name' />
<BoostrapDataColumn property='country' label='Country' />
</BootstrapDataTable>
);
}
}
This will render the following:
Name | Country |
---|---|
George | Greece |
John | Italy |
Mary | China |
Like what you see? Move on to examples or docs to find out more!