Hello friends, I have a problem with a json, has anyone gone through something similar?
I use React with inertia.
I have data that I want to save in json format, something like...
const { data, setData, post, processing, errors, reset } = useForm({
contact_one: {
name: "",
email: "",
phone_number: "",
extension: "",
position: "",
}
});
useEffect(() => {
return () => {
reset( "contact_one");
};
}, []);
const onHandleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setData("contact_one");
};
The information that I have in data is passed as props to a child component where the entries are according to the json, but filling these entries does not make the change in the value of what exists in data.
<InputBase
label="Contact name"
value={data.contact_one.name}
name="contact_one.name"
id="contact_one.name"
placeholder="contact_one_name"
handleChange={onHandleChange}
/>
Am I doing something wrong or is there a better way to do this?
I should mention that I'm moving from vue.js to react.js, sorry if something doesn't look right and also because of my English I'm learning.