Last active
March 15, 2019 13:29
-
-
Save erksch/184a50bcf0523d437dba06cd56448ee1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Orders.js | |
import React from 'react'; | |
import useOrders from './useOrders'; | |
function Orders() { | |
const { orders } = useOrders(); | |
return ( | |
<div> | |
<h1>Orders</h1> | |
<OrdersList orders={orders} /> | |
</div> | |
); | |
} | |
export default Orders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OrdersList.js | |
import React from 'react'; | |
import OrdersListItem from './OrdersListItem'; | |
function OrdersList(props) { | |
const { orders } = props; | |
return ( | |
<ul> | |
{orders.map(order => ( | |
<OrdersListItem | |
key={order.id} | |
order={order} | |
/> | |
))} | |
</ul> | |
); | |
} | |
export default OrdersList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OrdersListItem.js | |
import React from 'react'; | |
function OrdersListItem(props) { | |
const { order } = props; | |
return ( | |
<li> | |
<h2>{order.title}</h2> | |
<p>{order.description}</p> | |
</li> | |
); | |
} | |
export default OrdersListItem; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment