Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Order extends React.Component {
- ...
- render() {
- return <div>
- <strong>Total: $ {this.getTotal()}</strong>
- <table id='orderlines' style={tableStyles}>
- <tbody>
- {this.getLines()}
- </tbody>
- </table>
- </div>
- }
- getLines = () => {
- return this.state.orderLines.map((item, _) =>
- <OrderLine key={item.id} {...item} />)
- }
- }
- getTotal = () => (this.props.product.price * this.state.quantity).toFixed(2);
Add Comment
Please, Sign In to add comment