Skip to content

Instantly share code, notes, and snippets.

@srph
Created July 8, 2017 16:29
Show Gist options
  • Select an option

  • Save srph/271ead2c940b577418205fe432136031 to your computer and use it in GitHub Desktop.

Select an option

Save srph/271ead2c940b577418205fe432136031 to your computer and use it in GitHub Desktop.
React.js: Basic button loader
import React, {Component, PropTypes as T} from 'react';
import DotLoader from '@/components/DotLoader';
function ButtonLoader({loading, ...props}) {
return (
<button {...props} disabled={loading || disabled}>
{loading ? <DotLoader /> : props.children}
</button>
);
}
ButtonLoader.propTypes = {
loading: T.bool.isRequired
}
ButtonLoader.propTypes = {
loading: false
}
export default ButtonLoader;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment