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