import React from 'react';
//BrowserRouter: base configuration
//Route: configure specific routes and wrap component
import {
    BrowserRouter as Router,
    Routes,
    Route,
    Link
} from 'react-router-dom';

import Home from './components/home';
import Create from './components/create';
import Read from './components/read';
import Update from './components/update';
import Delete from './components/delete';

export default function App() {
  return (
      <div className="wrapper">
	  {/*h1: global page title*/}
	  {/*template: wrapper and h1 is rendered on every page*/}
	  {/*TODO Navigation or header on every page?*/}
	  <h1>App</h1>
	  <Router>
	      <div className="App">
		  <ul>
		      <li><Link to="/">Home</Link></li>
		      <li><Link to="/create">Create</Link></li>
		      <li><Link to="/read">Read</Link></li>
		      <li><Link to="/update">Update</Link></li>
		      <li><Link to="/delete">Delete</Link></li>
		  </ul>
		  <Routes>
		      {/*exact: match the exact value with the URL*/}
		      <Route exact path='/' element={< Home />}></Route>
		      <Route exact path='/create' element ={<Create />}></Route>
		      <Route exact path='/read' element={<Read />}></Route>
		      <Route exact path='/update' element={<Update />}></Route>
		      <Route exact path='/delete' element={<Delete />}></Route>
		  </Routes>
	      </div>
	  </Router>
      </div>
  );
};
