结构
assets中存放图片等widget
component中存放purecomponent(无state控制)
container中存放(state控制)的component
hoc中存放aux
Proptype
设置component的props type;
import PropTypes from 'prop-types';
burgerIngredient.propTypes= { //设置proptype, 返回一个string
type:PropTypes.string.isRequired
};
Life Cycle
shouldComponentUpdate(),省去无效的render
shouldComponentUpdate(nextProps, nextState){
return nextProps.show !== this.props.show;
}