May 2018
Intermediate to advanced
470 pages
13h 54m
English
The Cart view will contain the cart items and checkout details, but initially only the cart details will be displayed until the user is ready to check out.
mern-marketplace/client/cart/Cart.js:
<Grid container spacing={24}> <Grid item xs={6} sm={6}> <CartItems checkout={this.state.checkout} setCheckout={this.setCheckout}/> </Grid> {this.state.checkout && <Grid item xs={6} sm={6}> <Checkout/> </Grid>}</Grid>
The CartItems component is passed a checkout Boolean value, and a state update method for this checkout value, so that the Checkout component and options can be rendered based on user interaction.
mern-marketplace/client/cart/Cart.js:
setCheckout = val =>{ this.setState({checkout: val})}
The Cart component will be accessed at ...
Read now
Unlock full access