html-react-parser replace onClick

html-react-parser replace example with onClick https://github.com/remarkablemark/html-react-parser/issues/53

HTML

<div id="root"></div>

<!-- HTMLReactParser -->
<script src="https://unpkg.com/html-react-parser@latest/dist/html-react-parser.min.js"></script>

React

class App extends React.Component {
  work() {
    alert('work');
  }

  render() {
    return HTMLReactParser("<form name='captchasubmit' id='captchasubmit'><input type=\"radio\" onclick=\"document.getElementById('otp').value='phone';\" name=\"otpselection\" value=\"phone\"/> phone method<br/><input type=\"radio\" onclick=\"document.getElementById('otp').value='email';\" name=\"otpselection\" value=\"email\"/> email method<br/><input type=\"hidden\" id=\"otp\" name=\"otp\" value=\"none\"/></form>")
  }
}

ReactDOM.render(<App />, document.getElementById('root'));