The useMedia hook is a simple helper to quickly get something from the WordPress Media Library. It accepts the id of the media element as it's only parameter and returns an object containing the media object itself (media), whether it is still loading (isResolvingMedia), and whether it has finished resolving (hasResolvedMedia).
@todo paste link to working demo here; probably on documentation site
https://github.com/10up/block-components/tree/develop/hooks/use-media