function App() {
return (
<Router>
<div>
<nav>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/list">List Expenses</Link>
</li>
<li>
<Link to="/add">Add Expense</Link>
</li>
</ul>
</nav>
<Switch>
<Route path="/list">
<ExpenseEntryItemList />
</Route>
<Route path="/add">
<ExpenseEntryItemForm />
</Route>
<Route path="/">
<Home />
</Route>
</Switch>
</div>
</Router>
);
}
The code in the function starts with a <Router> element which encloses all the other elements. The <div> element contains the main contents of the page, including the header and the main body.
The <nav> element contains a list of links which take the user to different parts of the page. The <ul> element contains a list of items, one per line. The items in the list are all links, which take the user to different parts of the page. The <li> element contains a link which takes the user to a specific section of the list.
The <Link to="/">Home</Link> link in the <li> element points to the home page of the application.
The <Link to="/list">List Expenses</Link> link in the <li> element takes the user to a list of expenses. The <Link to="/add">Add Expense</Link> link in the <li> element takes the user to a form where they can add a new expense.
0 Comments
Log in to add a comment