I'm trying to get a basic field input using the following in Javascript/React
export default (value, docRef, field, label) => {
return (
<div className="pr-4 w-full">
<input
className="px-4 py-2 border w-full"
value={value}
placeholder={label}
onChange={(e) => {
const fs = getFirestore(app);
setDoc(docRef, { [field]: e.target.value }, { merge: true });
}}
></input>
</div>
);
};
I am populating this field like so:
{doctors.map((d) => {
const ref = doc(getFirestore(app), d.path);
console.log(ref);
return (
<tr key={ref.id}>
<td className="py-4">
{console.log(d.firstName)}
<FirestoreFieldInput
value={d.firstName}
field="firstName"
docRef={ref}
label="First Name"
></FirestoreFieldInput>
</td>
</tr>
);
})}
But anytime I try to edit the input it throws the following error: Uncaught FirebaseError: Expected type 'Ta', but it was: a custom Object object
and I am unsure why.