Open joshuacba08 opened 1 year ago
Necesitamos crear un componente button para usar en distintas partes de la aplicación.
<Button title="Buy now" color="primary" disable="true" handleclick={ onAdd } />
import PropTypes from 'prop-types'; import './Button.css'; const Button = (props) => { return ( <button className={`button button-${props.color}`} onClick={ props.handleClick } > {props.title} </button> ) } Button.propTypes = { // Validating the props passed to the component title: PropTypes.string, color: PropTypes.string, handleClick: [PropTypes.func] // si tira un error en consola, sacar el handleClick o todo el proptype } export default Button;
Necesitamos crear un componente button para usar en distintas partes de la aplicación.