material-async-button
v0.0.3
Published
React Material UI button for async function
Downloads
3
Maintainers
Readme
React Material Async Button
Install
yarn add material-async-button
Usage
import React from "react";
import { render } from "react-dom";
import Button from "material-async-button";
function asyncSuccess(text) {
return new Promise((resolve) => {
setTimeout(() => {
console.log(text || 'Success')
resolve();
}, 1000);
});
}
function App() {
return (
<div>
<Button iconDelay={1000} action={asyncSuccess} variant="contained">Save</Button>
<Button
progressColor="secondary"
action={() => asyncSuccess('Test')}
color="primary"
variant="contained"
>
Save
</Button>
</div>
);
}
render(
<App/>,
document.getElementById("root"),
);