JavaScript FrameworksReact

Create A Flight List Table in React (Three Part Series)

Part 1: We’ll clean up the App.js template and grab a bootstrap table template and integrated into our React app. We’ll also tweak the table to give it a responsive feature and make sure that proper CSS style rules are conformed to JSX syntax.

Here’s the state of our App.js at this point. Some rows were removed for brevity.

import React from 'react';
import './App.css';
import Nav from './components/Nav';
import Footer from './components/Footer';
import NavData from './models/NavData';

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = { navData: NavData };
  }
  render() {
    return (
      <div className="App">
        <Nav navData={this.state.navData} />

        <div className="container">
          <div className="row">
            <div className="col-md-12 mb-5">
              <h1 className="text-left">Flight Schedule</h1>
              <div className="table-responsive border p-4 bg-light rounded">
                <p className="text-left font-weight-bold">Active Flight Schedule</p>
                <table className="table table-hover">
                  <thead className="table-borderless table-secondary">
                    <tr>
                      <th scope="col">#</th>
                      <th scope="col">First</th>
                      <th scope="col">Last</th>
                      <th scope="col">Handle</th>
                      <th scope="col">Handle</th>
                      <th scope="col">Handle</th>
                      <th scope="col">Handle</th>
                      <th scope="col">Handle</th>
                      <th scope="col">Handle</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td scope="row">1</td>
                      <td>Mark</td>
                      <td>Otto</td>
                      <td>@mdo</td>
                      <td>@mdo</td>
                      <td>@mdo</td>
                      <td>@mdo</td>
                      <td>@mdo</td>
                      <td>@mdo</td>
                    </tr>                   
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
        <Footer />
      </div>
    );
  }
}

export default App;
Verified by MonsterInsights