Skip to content

Instantly share code, notes, and snippets.

@emanueleDiVizio
Last active May 28, 2020 20:33
Show Gist options
  • Save emanueleDiVizio/e8c780c604bca17bd0a0b98b110af4d7 to your computer and use it in GitHub Desktop.
Save emanueleDiVizio/e8c780c604bca17bd0a0b98b110af4d7 to your computer and use it in GitHub Desktop.
const CoolButton = () => {
const playerRef = useRef(null);
const onPress = () => {}
useEffect(() => {
playerRef.current = loadPlayer('filename.wav');
return () => {
playerRef.current.destroy();
};
}, []);
return (
<Button
title="Play!"
onPress={onPress}
/>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment