Download wp-calypso/client/components/data/query-active-promotions/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 571 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-active-promotions/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/data/query-active-promotions/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-active-promotions/index.jsx
571 Bytes
| import { useEffect } from 'react'; | |
| import { useDispatch } from 'react-redux'; | |
| import { requestActivePromotions } from 'calypso/state/active-promotions/actions'; | |
| import { isRequestingActivePromotions } from 'calypso/state/active-promotions/selectors'; | |
| const request = () => ( dispatch, getState ) => { | |
| if ( ! isRequestingActivePromotions( getState() ) ) { | |
| dispatch( requestActivePromotions() ); | |
| } | |
| }; | |
| export default function QueryActivePromotions() { | |
| const dispatch = useDispatch(); | |
| useEffect( () => { | |
| dispatch( request() ); | |
| }, [ dispatch ] ); | |
| return null; | |
| } | |