Download wp-calypso/client/components/data/query-active-theme/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 714 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-active-theme/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/data/query-active-theme/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-active-theme/index.jsx
714 Bytes
| import PropTypes from 'prop-types'; | |
| import { useEffect } from 'react'; | |
| import { useDispatch } from 'react-redux'; | |
| import { requestActiveTheme } from 'calypso/state/themes/actions'; | |
| import { isRequestingActiveTheme } from 'calypso/state/themes/selectors'; | |
| const request = ( siteId ) => ( dispatch, getState ) => { | |
| if ( siteId && ! isRequestingActiveTheme( getState(), siteId ) ) { | |
| dispatch( requestActiveTheme( siteId ) ); | |
| } | |
| }; | |
| function QueryActiveTheme( { siteId } ) { | |
| const dispatch = useDispatch(); | |
| useEffect( () => { | |
| dispatch( request( siteId ) ); | |
| }, [ dispatch, siteId ] ); | |
| return null; | |
| } | |
| QueryActiveTheme.propTypes = { | |
| siteId: PropTypes.number.isRequired, | |
| }; | |
| export default QueryActiveTheme; | |