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