Inject reCaptcha in phtml file in Magento 2
the easy way to Inject reCaptcha in phtml file in Magento 2 to add PHP code, use this code to add reCaptcha into newsletter form
<?php
echo $block->getLayout()
->createBlock('MSP\ReCaptcha\Block\Frontend\ReCaptcha',
'msp-recaptcha-newsletter',
['data' =>
[
'jsLayout' =>
[
'components' =>
[
'msp-recaptcha' =>
[
'component' => 'MSP_ReCaptcha/js/reCaptcha',
'reCaptchaId' => 'msp-recaptcha-newsletter',
'zone' => 'newsletter',
'badge'=>'bottomright',
'settings' =>[
'size'=>'invisible'
]
]
]
]
]
]
)
->setTemplate('MSP_ReCaptcha::msp_recaptcha_newsletter.phtml')
->toHtml();
?>