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( ) ( )
4 ответов
+ 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)
+ 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)
0
Hii there can you try it once ?
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)