1

我尝试import { Button, Form, Input } from 'formik-semantic-ui'; 在组件注册中使用,但收到此警告:

Warning: findDOMNode中已弃用StrictModefindDOMNode传递了一个实例,RefFindNode该实例位于 inside StrictMode。相反,直接将 ref 添加到要引用的元素。

in button (created by Button)
in RefFindNode (created by Ref)
in Ref (created by Button)
in Button
in Unknown (at Register.js:18)
in form (created by Form)
in Form (created by Formik)
in Formik (created by FormikForm)
in FormikForm (at Register.js:12)
in Unknown (at App.js:7)
in div (at App.js:6)
in App (at src/index.js:9)
in StrictMode (at src/index.js:8)

这是代码:

import React, {useState} from 'react'
import { Button, Form, Input } from 'formik-semantic-ui';
import * as Yup from 'yup';

export default ()=>{
    const handleSubmit = (values) => {
        debugger;
        console.log(values);
    }

    return (
       <Form initialValues={{firstName:'',lastName:'', emailAddress:''}} onSubmit = {handleSubmit}>
            <Input label="Email" name="emailAddress" />
            <Form.Group widths="2">
                <Input label="First Name" name="firstName" />
                <Input label="Last Name" name="lastName" />
            </Form.Group>
            <Button.Submit>Submit</Button.Submit>
            <Button.Reset>Reset</Button.Reset>
        </Form>
    )
}
4

0 回答 0