Chapter 8. The Finished App

All the components of the new app are done and testable in the discovery tool (http://localhost:3000/discovery). Now it’s time to put them all together into a working application (available in the browser as http://localhost:3000/). Figure 8-1 shows the desired result when the user loads the app for the first time. There is a single row of default data coming from schema’s samples to demonstrate the purpose of the app to the user.

rur2 0801
Figure 8-1. Loading the finished app for the first time

Figure 8-2 shows the dialog that pops up when the user clicks the + ADD WHINE button.

rur2 0802
Figure 8-2. Adding a new record

Figure 8-3 shows the state of the app after the user has added one more row.

rur2 0803
Figure 8-3. Two records in the table

Since you already have the header, body, the table component Excel, and the dialog component, the rendering is merely a question of assembling them, like so:

<div>
  <Header/>
  <Body>
    <Excel/>
    <Dialog>
      <Form/>
    </Dialog>
  </Body>
</div>

Then the main task is providing the correct props to these components and taking care of the data flow between them. Let’s create a component called DataFlow to take care of all this. DataFlow should have all ...

Get React: Up & Running, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.