UNPKG

pay-sdk-react

Version:

A cross-platform payment SDK for React, supporting Alipay, WeChat Pay, PayPal, Stripe, Payssion, and Airwallex, compatible with H5, PC, and App environments.

12 lines 480 B
import { useInitialized } from "../hooks/use-initialized"; export const ShouldRender = props => { const shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose); return shouldRender ? props.children : null; }; export function useShouldRender(active, forceRender, destroyOnClose) { const initialized = useInitialized(active); if (forceRender) return true; if (active) return true; if (!initialized) return false; return !destroyOnClose; }