Guest User

Untitled

a guest
Dec 11th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class Order extends React.Component {
  2. ...
  3. render() {
  4. return <div>
  5. <strong>Total: $ {this.getTotal()}</strong>
  6. <table id='orderlines' style={tableStyles}>
  7. <tbody>
  8. {this.getLines()}
  9. </tbody>
  10. </table>
  11. </div>
  12. }
  13.  
  14. getLines = () => {
  15. return this.state.orderLines.map((item, _) =>
  16. <OrderLine key={item.id} {...item} />)
  17. }
  18. }
  19.  
  20. getTotal = () => (this.props.product.price * this.state.quantity).toFixed(2);
Add Comment
Please, Sign In to add comment