1 2 3 4 5 6 7 8 9 10 11 12 13
import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; const Alert = (props) => ( <div className={ classnames('alert', `alert-${props.type}`) }>{ props.children }</div> ); Alert.propTypes = { type: PropTypes.string.isRequired }; export default Alert;