Created
April 1, 2020 00:54
-
-
Save flavioribeirojr/2a492567938ec67df207399013b81ce2 to your computer and use it in GitHub Desktop.
Product List with Redux useSelector hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useSelector } from 'react-redux'; | |
function ProductList() { | |
const cart = useSelector(state => state.shop.cart); | |
return ( | |
<div> | |
{ | |
cart | |
.map(cartProduct => ( | |
<h1 key={cartProduct.id}> | |
{ cartProduct.name } | |
</h1> | |
)) | |
} | |
</div> | |
); | |
} | |
export default ProductList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment