mirror of https://github.com/sgoudham/carbon.git
move tweet button into its own Comp w/ useAsyncCallback
parent
35ed5ae1e7
commit
9cb4287a20
@ -0,0 +1,15 @@
|
||||
import React from 'react'
|
||||
import { useAsyncCallback } from '@dawnlabs/tacklebox'
|
||||
|
||||
import Button from './Button'
|
||||
|
||||
function TweetButton(props) {
|
||||
const [onClick, { loading }] = useAsyncCallback(props.onClick)
|
||||
return (
|
||||
<Button border large padding="0 16px" margin="0 8px 0 0" onClick={onClick} color="#57b5f9">
|
||||
{loading ? 'Loading...' : 'Tweet'}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default React.memo(TweetButton)
|
Loading…
Reference in New Issue