Download wp-calypso/client/data/themes/with-is-fse-active.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 787 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/themes/with-is-fse-active.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/themes/with-is-fse-active.js
-
curl -L -o with-is-fse-active.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/themes/with-is-fse-active.js
787 Bytes
| import { createHigherOrderComponent } from '@wordpress/compose'; | |
| import { useSelector } from 'react-redux'; | |
| import { isUserLoggedIn } from 'calypso/state/current-user/selectors'; | |
| import { getSelectedSiteId } from 'calypso/state/ui/selectors'; | |
| import { useActiveThemeQuery } from './use-active-theme-query'; | |
| const withIsFSEActive = createHigherOrderComponent( | |
| ( Wrapped ) => ( props ) => { | |
| const siteId = useSelector( getSelectedSiteId ); | |
| const userLoggedIn = useSelector( isUserLoggedIn ); | |
| const { data, isLoading } = useActiveThemeQuery( siteId, userLoggedIn ); | |
| const isFSEActive = data?.[ 0 ]?.is_block_theme ?? false; | |
| return <Wrapped { ...props } isFSEActiveLoading={ isLoading } isFSEActive={ isFSEActive } />; | |
| }, | |
| 'withIsFSEActive' | |
| ); | |
| export default withIsFSEActive; | |