0

我需要在 DynamoDB中存储<PhoneInput>电话号码值和标签国家/地区输入。<Select>当我尝试提交时,它没有反映在我的数据库中。那么我必须做出哪些改变。我用过:npm react-phone-number-inputnpm react-select-country-list

提前致谢。

<PhoneInput 
     className="phone"
     placeholder="Enter phone number"
     value={value}
     onChange={setValue} name="phonenumber" /> 
<Select className="react-select-country-list" options={options}
    name="country" value={value} onChange={changeHandler} />
 async function addContact() {
    const data = {
        body: {
            first_name: formState.first_name,
            last_name: formState.last_name,
            email: formState.email,
            phonenumber: formState.phonenumber,
            help: formState.help,
            country: formState.country,
            message: formState.message
          

        }
    }
        console.log(data);
        const apiData = await API.post('contact', '/contacts', data);
        console.log({ apiData };
        alert('Mail sent');
};
4

1 回答 1

0

通过更改 onChange = onChange={x => updateFormState('phonenumber', x)} 解决了它

于 2021-02-01T10:28:20.350 回答