I need to store a <PhoneInput>
phone number value and a <Select>
tag country input in DynamoDB. When I try to submit, its not getting reflected in my db. So what changes do I have to make.
I used: npm react-phone-number-input
and npm react-select-country-list
.
Thanks in advance.
<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');
};
Solved it by changing the onChange = onChange={x => updateFormState('phonenumber', x)}