How does the Gutenberg mobile/tablet/desktop preview work with media queries?

I investigated the states set using React Dev Tools and found the preview modes are set under the deviceType key. Went through the Gutenberg source and came across the __experimentalGetPreviewDeviceType function.

/**
 * Returns the current deviceType.
 */
const { deviceType } = useSelect( select => {
    const { __experimentalGetPreviewDeviceType } = select( 'core/edit-post' );

    return {
        deviceType: __experimentalGetPreviewDeviceType(),
    }
}, [] );

I’m using this to conditionally set the CSS classes. Worked for me and I hope the Gallery block is doing the same way.