Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

define component react with default props and props type

const Camper = props => <p>{props.name}</p>;

Camper.defaultProps = {
  name: "CamperBot"
};

Camper.propTypes = {
  name: PropTypes.string.isRequired
};
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #define #component #react #default #props #props #type
ADD COMMENT
Topic
Name
4+9 =