react-code-dataset / wp-calypso /client /components /data /query-all-jetpack-sites-plugins /index.tsx
react-code-dataset / wp-calypso /client /components /data /query-all-jetpack-sites-plugins /index.tsx
Download wp-calypso/client/components/data/query-all-jetpack-sites-plugins/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 687 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-all-jetpack-sites-plugins/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/data/query-all-jetpack-sites-plugins/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-all-jetpack-sites-plugins/index.tsx
687 Bytes
| import { useEffect } from 'react'; | |
| import { useDispatch } from 'calypso/state'; | |
| import { fetchAllPlugins } from 'calypso/state/plugins/installed/actions'; | |
| import { isRequestingForAllSites } from 'calypso/state/plugins/installed/selectors'; | |
| import type { CalypsoDispatch } from 'calypso/state/types'; | |
| import type { AppState } from 'calypso/types'; | |
| const request = () => ( dispatch: CalypsoDispatch, getState: AppState ) => { | |
| if ( ! isRequestingForAllSites( getState() ) ) { | |
| dispatch( fetchAllPlugins() ); | |
| } | |
| }; | |
| export default function QueryAllJetpackSitesPlugins() { | |
| const dispatch = useDispatch(); | |
| useEffect( () => { | |
| dispatch( request() ); | |
| }, [ dispatch ] ); | |
| return null; | |
| } | |