Skip to content

Commit 1aac8c4

Browse files
authored
Update useClipboard useEffect to support async functions
1 parent cd2e45b commit 1aac8c4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/useClipboard.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import { Clipboard } from 'react-native'
44
export default () => {
55
const [data, updateClipboardData] = useState('')
66

7-
useEffect(async () => {
8-
const content = await Clipboard.getString()
9-
updateClipboardData(content)
7+
useEffect(() => {
8+
async function updateClipboard() {
9+
const content = await Clipboard.getString()
10+
updateClipboardData(content);
11+
}
12+
updateClipboard()
1013
}, [])
1114

1215
function setString(content) {

0 commit comments

Comments
 (0)