component: apply PropType plugin to props
This commit is contained in:
parent
78bf7bd632
commit
ffeb447dc1
@ -1,10 +1,13 @@
|
||||
import React from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classes from './burgerIngredient.css';
|
||||
|
||||
const burgerIngredient = (props) => {
|
||||
class BurgerIngredient extends Component {
|
||||
render() {
|
||||
let ingredient = null;
|
||||
|
||||
switch (props.type) {
|
||||
switch (this.props.type) {
|
||||
case ('bread-bottom'):
|
||||
ingredient = <div className={classes.BreadBottom}></div>
|
||||
break;
|
||||
@ -32,8 +35,12 @@ const burgerIngredient = (props) => {
|
||||
ingredient = null;
|
||||
break;
|
||||
}
|
||||
|
||||
return ingredient;
|
||||
}
|
||||
}
|
||||
|
||||
BurgerIngredient.PropTypes = {
|
||||
type: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
export default burgerIngredient;
|
Loading…
Reference in New Issue
Block a user