Download wp-calypso/client/data/p2/with-p2-hub-p2-count.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/p2/with-p2-hub-p2-count.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/p2/with-p2-hub-p2-count.js
-
curl -L -o with-p2-hub-p2-count.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/p2/with-p2-hub-p2-count.js
497 Bytes
| import { createHigherOrderComponent } from '@wordpress/compose'; | |
| import useP2HubP2sQuery from 'calypso/data/p2/use-p2-hub-p2s-query'; | |
| const withP2HubP2Count = createHigherOrderComponent( | |
| ( Wrapped ) => ( props ) => { | |
| // Limit query to 1 since we are only interested in the totalItems count. | |
| const { data } = useP2HubP2sQuery( props.siteId, { limit: 1 } ); | |
| return <Wrapped { ...props } p2HubP2Count={ data?.totalItems || 0 } />; | |
| }, | |
| 'withP2HubP2Count' | |
| ); | |
| export default withP2HubP2Count; | |