Created
March 15, 2019 11:07
-
-
Save erksch/aea38fd3d460b90873a3011ebdfdcc5c to your computer and use it in GitHub Desktop.
Orders Class Component
This file contains hidden or 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
import React from 'react'; | |
import OrderService from './OrderService'; | |
class Orders { | |
constructor(props) { | |
super(props); | |
this.state = { | |
orders: [], | |
}; | |
} | |
async componentDidMount() { | |
const orders = await OrderService.list(); | |
this.setState({ orders }); | |
} | |
return ( | |
<div> | |
<h1>Orders</h1> | |
<OrdersList orders={orders} /> | |
</div> | |
); | |
} | |
export default Orders; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment