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