Fill in the blanks to correctly export the Cart component. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Fill in the blanks to correctly export the Cart component.

Fill in the blanks to correctly export the Cart component. function Cart(props) { const arr = props.cart; const listItems = arr.map((val, index) => <li key={index}>{val}</li> ); return <ul>{listItems}</ul>; } mapStateToProps(state) { return {cart: state.cart} } default connect( ) ( )

3rd Jul 2020, 12:19 PM
Widik Zulvan Zakaria
Widik Zulvan Zakaria - avatar
4 Answers
+ 1
Ans: function Cart(props) { const arr = props.cart; const listItems = arr.map((val, index) => <li key={index}>{val}</li> ); return <ul>{listItems}</ul>; } function mapStateToProps(state) { return {cart: state.cart} } default connect(mapStateToProps) (cart)
18th Jul 2020, 6:49 PM
MD SHAKIL
MD SHAKIL - avatar
+ 1
Ans: function Cart(props) { const arr = props.cart; const listItems = arr.map((val, index) => <li key={index}>{val}</li> ); return <ul>{listItems}</ul>; } function mapStateToProps(state) { return {cart: state.cart} } export default connect(mapStateToProps) (cart)
19th Sep 2021, 6:31 PM
Mayur Ramdas Surase
Mayur Ramdas Surase - avatar
0
Hii there can you try it once ?
4th Jul 2020, 6:16 AM
Nilesh
0
function Cart(props) { const arr = props.cart; const listItems = arr.map((val, index) => <li key={index}>{val}</li> ); return <ul>{listItems}</ul>; } function mapStateToProps(state) { return {cart: state.cart} } default connect(mapStateToProps) (cart)
31st Jan 2021, 10:20 AM
Syed Fahad Ahmed
Syed Fahad Ahmed - avatar