UNPKG

@wojtekmaj/react-recaptcha-v3

Version:

Integrate Google reCAPTCHA v3 with your React app

19 lines (18 loc) 512 B
export function loadScript({ async, appendTo, defer, id, nonce, src }) { const script = document.createElement('script'); if (async !== undefined) { script.async = async; } if (defer !== undefined) { script.defer = defer; } if (id) { script.id = id; } if (nonce) { script.setAttribute('nonce', nonce); } script.src = src; const appendTarget = appendTo === 'head' ? document.head : document.body; appendTarget.appendChild(script); }