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 • 494 B
JavaScript
import { useInitialized } from '../hooks/use-initialized';
export var ShouldRender = function ShouldRender(props) {
var shouldRender = useShouldRender(props.active, props.forceRender, props.destroyOnClose);
return shouldRender ? props.children : null;
};
export function useShouldRender(active, forceRender, destroyOnClose) {
var initialized = useInitialized(active);
if (forceRender) return true;
if (active) return true;
if (!initialized) return false;
return !destroyOnClose;
}