Chapter 15. Submitting Orders
Although Code Café’s users can build an order, they cannot actually send it to the café.
By the end of this chapter, you will store orders on the server, ready for the café staff to fulfill (Figure 15.1, “Orders submitted to the server”).
Submitting a Form
Back in Chapter 8, Interacting with a Server, you made your first request to the API to fetch items. You wrapped the request in the useEffect
hook to ensure that it would send when the component initially rendered:
useEffect(() => { axios.get('/api/items') .then((result) => setItems(result.data)) ...
Get React Programming: The Big Nerd Ranch Guide 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.