Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import {compose, setPropTypes, defaultProps} from 'recompose'
const enhance = compose(
setPropTypes({
onClick: PropTypes.func,
type: PropTypes.oneOf(['submit', 'button']),
className: PropTypes.func,
children: PropTypes.func.isRequired,
isLoading: PropTypes.bool,
}),
defaultProps({
type: 'button',
}),
)
const Button = ({ type, className, children, onClick, isLoading }) => {
return (
<button type={type} className={className} onClick={onClick}>
{isLoading && <Loading />}
{!isLoading && children}
</button>
)
}
export default enhance(Button)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment