1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
function Button({ children, modifiers, onClickHandler, type = "button" }) { let classNames = "btn"; if (modifiers && modifiers.length > 0) { for (let i = 0; i < modifiers.length; i++) { classNames += ` btn--${modifiers[i]}`; } } return ( <button type={type} className={classNames} onClick={onClickHandler}> {children} </button> ); } export default Button;