如何制作反应有效的代码(添加内部脚本)

How to make react-valid code (add inner script)

我需要更改此代码以使其对 React 有效

<script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff_v2.js"></script>
<form name="TinkoffPayForm" onsubmit="pay(this); return false;">
  <input class="tinkoffPayRow" type="hidden" name="terminalkey" value="TinkoffBankTest">
  <input class="tinkoffPayRow" type="hidden" name="frame" value="true">
  <input class="tinkoffPayRow" type="hidden" name="language" value="ru"> 
    <input class="tinkoffPayRow" type="text" placeholder="Сумма заказа" name="amount" required>
    <input class="tinkoffPayRow" type="text" placeholder="Номер заказа" name="order">
    <input class="tinkoffPayRow" type="text" placeholder="Описание заказа" name="description">
    <input class="tinkoffPayRow" type="text" placeholder="ФИО плательщика" name="name">
    <input class="tinkoffPayRow" type="text" placeholder="E-mail" name="email">
    <input class="tinkoffPayRow" type="text" placeholder="Контактный телефон" name="phone">
    <input class="tinkoffPayRow" type="submit" value="Оплатить">
</form>

我将 <script> 添加到 index.html,在 React Component 中创建了 <form>,并将 ref 添加到表单

我创建了 const w = window as any 并添加了

const onSubmit = () => {
    w.pay(form.current);
  }

但是没用

我需要将什么作为参数传递给 w.pay 函数?

我通过添加 dangerouslySetInnerHTML

解决了问题