基础组件
import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';
import { addToCart, removeFromCart, changeQuantity } from '../../actions/CartActions';
@connect(null, { addToCart, removeFromCart, changeQuantity })
class Product extends Component {
constructor() {
super();
this.addToCart = this.addToCart.bind(this);
}
addToCart() {
this.props.addToCart(this.props.product);
}
removeFromCart() {
this.props.removeFromCart(this.props.product);
}
changeProductQuantity() {
this.props.changeQuantity(this.props.product);
}
render() {
return (
<div className="product_box">
<h3>{this.props.product.title}</h3>
<Link to={`details/${this.props.product._id}`}>
<img src={this.props.product.image_url} alt={this.props.product.title} />
</Link>
<p>{this.props.product.description}</p>
<p className="product_price">{this.props.product.price} {this.props.product.currency}</p>
<Link onClick={this.addToCart} className="addtocart" …Run Code Online (Sandbox Code Playgroud) 我是Angular 4的新手,我刚刚通过Angular Cli创建了一个项目,我得到了错误
Uncaught TypeError: useValue,useFactory,data is not iterable!
Run Code Online (Sandbox Code Playgroud)
我无法解决它.我安装并重新安装了cli,我只是想知道如何解决它.我所做的只是
ng new myprj
mkdir myprj
ng serve
Run Code Online (Sandbox Code Playgroud) angular ×1
casperjs ×1
javascript ×1
karma-runner ×1
node.js ×1
oop ×1
phantomjs ×1
react-redux ×1
reactjs ×1
redux ×1