Skip to content

Instantly share code, notes, and snippets.

@erksch
Created March 15, 2019 11:07
Show Gist options
  • Save erksch/aea38fd3d460b90873a3011ebdfdcc5c to your computer and use it in GitHub Desktop.
Save erksch/aea38fd3d460b90873a3011ebdfdcc5c to your computer and use it in GitHub Desktop.
Orders Class Component
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