Created
December 27, 2021 15:35
-
-
Save cameronp98/0d48e0020b4e13208bef3c1a7f24d773 to your computer and use it in GitHub Desktop.
Action button (for use with e.g tailwindcss)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import ActionButton from './components/ActionButton' | |
function App() { | |
const btnAction = () => { | |
console.log('Started action.') | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
console.log('Done!') | |
resolve() | |
}, 2000) | |
}) | |
} | |
return ( | |
<> | |
<ActionButton action={btnAction} /> | |
</> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment