Download wp-calypso/client/data/media-storage/with-media-storage.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 554 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/media-storage/with-media-storage.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/media-storage/with-media-storage.js
-
curl -L -o with-media-storage.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/media-storage/with-media-storage.js
554 Bytes
| import { Site } from '@automattic/data-stores'; | |
| import { createHigherOrderComponent } from '@wordpress/compose'; | |
| import { useSelector } from 'react-redux'; | |
| import { getSelectedSiteId } from 'calypso/state/ui/selectors'; | |
| const withMediaStorage = createHigherOrderComponent( | |
| ( Wrapped ) => ( props ) => { | |
| const siteId = useSelector( getSelectedSiteId ); | |
| const { data } = Site.useSiteMediaStorage( { siteIdOrSlug: siteId } ); | |
| return <Wrapped { ...props } mediaStorage={ data ?? {} } />; | |
| }, | |
| 'WithMediaStorage' | |
| ); | |
| export default withMediaStorage; | |