Download wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 529 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan.ts
-
curl -L -o use-current-plan.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/plans/hooks/use-current-plan.ts
529 Bytes
| import { useMemo } from '@wordpress/element'; | |
| import useSitePlans from '../queries/use-site-plans'; | |
| import { SitePlan } from '../types'; | |
| interface Props { | |
| siteId?: string | number | null; | |
| } | |
| const useCurrentPlan = ( { siteId }: Props ): SitePlan | undefined => { | |
| const sitePlans = useSitePlans( { coupon: undefined, siteId } ); | |
| return useMemo( | |
| () => | |
| sitePlans?.data | |
| ? Object.values( sitePlans?.data ).find( ( plan ) => plan.currentPlan ) | |
| : undefined, | |
| [ sitePlans.data ] | |
| ); | |
| }; | |
| export default useCurrentPlan; | |