i have this div:
<div>
<MyHeroes>
{myHeroesList.map((hero) => (
<div key={uuid()} className="hero" onClick={handleName}>
{hero}
<div
className="close"
onClick={() => {
handleRemoveHero(hero);
}}
>
<CloseRoundedIcon />
</div>
</div>
))}
</MyHeroes>
</div>
and I have this error popping up when the handleRemoveHero(hero) function is running. It's basically deleting documents from Firebase.
Warning: A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component
Function itself:
const handleRemoveHero = (hero) => {
db.collection("swapi")
.where("user", "==", user?.displayName)
.where("liked", "==", hero)
.get()
.then((data) => {
const id = data.docs[0].id;
db.collection("swapi").doc(id).delete();
});
};
myHeroesList
being updated via a firebase change listener? – sleepystar96