📜  React Hook 表单 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:44.894000             🧑  作者: Mango

代码示例2
import React from 'react';
import ReactDOM from 'react-dom';
import { connect } from "react-redux";
import useForm from 'react-hook-form';

function SampleForm() {
  const { register, handleSubmit } = useForm();
  const onSubmit = data => {
    alert(JSON.stringify(data));
  };

  return (
    
); } class Sample extends Component { constructor(props) { super(props); } render() { return ; } } export default connect()(Sample); const rootElement = document.getElementById('root'); ReactDOM.render(, rootElement);