doc: add user to useStateValue and conditional rendering
This commit is contained in:
1 parent
2e512535a0
commit
e974e40104
1 file changed
+2
-1
@@ -8,7 +8,7 @@ import CheckoutProduct from "./CheckoutProduct";
|
|||||||
import "./Checkout.css";
|
import "./Checkout.css";
|
||||||
|
|
||||||
function Checkout() {
|
function Checkout() {
|
||||||
const [{ basket }, dispatch] = useStateValue();
|
const [{ basket, user }, dispatch] = useStateValue();
|
||||||
return (
|
return (
|
||||||
<section className="checkout">
|
<section className="checkout">
|
||||||
<article className="checkout__left">
|
<article className="checkout__left">
|
||||||
@@ -19,6 +19,7 @@ function Checkout() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
{!user ? "" : <h3>Hello, {!user?.email}</h3>}
|
||||||
<h2 className="checkout__title">Your Shopping Basket</h2>
|
<h2 className="checkout__title">Your Shopping Basket</h2>
|
||||||
{basket.map((item) => (
|
{basket.map((item) => (
|
||||||
<CheckoutProduct
|
<CheckoutProduct
|
||||||
|
|||||||
Reference in new issue
Block a user