April 2020
Intermediate to advanced
716 pages
18h 55m
English
With the order placed and the cart emptied, we can redirect the user to the order view, which will show them the details of the order that was just placed. To implement this redirect, we can use the Redirect component from React Router, as shown in the following code.
mern-marketplace/client/cart/PlaceOrder.js:
if (values.redirect) { return (<Redirect to={'/order/' + values.orderId}/>)}
This redirection also works as an indication to the user that the checkout process has been completed. A completed checkout process will also result in a new order being created in the application's backend. In the next section, we will look into the implementation of creating and storing these new orders in the database.
Read now
Unlock full access